<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
</head>
<body ng-app="myNoteApp" ng-controller="myNoteCtrl">
<h3>我的笔记</h3>
<textarea ng-model="message" cols="40" rows="10"></textarea>
<p>
<button ng-click="save()">保存</button>
<button ng-click="clear()">清除</button>
</p>
<p>Number of characters left:<span ng-bind="left()"></span></p>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module('myNoteApp',[]);
app.controller("myNoteCtrl",function($scope){
$scope.message = "";
$scope.left = function(){
return 100 - $scope.message.length;
}
$scope.clear = function(){
$scope.message = "";
}
$scope.save = function(){
alert("note saved");
}
});
</script>
</body>
</html>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。