AngularJS笔记示例

前端之家收集整理的这篇文章主要介绍了AngularJS笔记示例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我的笔记示例:

<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">
<title>AngularJS笔记</title>

</head>
<body ng-app="myApp">

<div ng-controller="myCtrl"> 

<h2>我的笔记</h2>

<p><!--开源中国bug<textarea-0 ng-model="message" cols="40" rows="10"></textarea-0>开源中国bug--></p>

<p>
<button ng-click="save()">保存</button>
<button ng-click="clear()">清除</button>
</p>

<p>剩余字数:<span ng-bind="left()"></span></p>

</div>

<script src="angular.min.js"></script>

<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope){
	$scope.message = "";
	$scope.left = function() {return 100 - $scope.message.length;};
	$scope.clear = function() {$scope.message = "";};
	$scope.save = function() {alert("保存");};
});
</script>

</body>
</html>

猜你在找的Angularjs相关文章