你四不四傻!?
<!doctype html>
<html ng-app = "myapp">
<head>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-controller = "TestController">
<p>次数:{{cont}}</p>
<input type = "text" ng-change = "contClick()" ng-model = "continput"></input>
</div>
<div ng-controller = "keypressController">
<p>次数:{{keyin}}</p>
<input type = "text" ng-keypress = "keyClick()" ng-model = "keyinput"></input>
</div>
<form ng-controller = "submitController" ng-submit = "subClick()">
<p>{{sub}}</p>
<input type = "text" ng-model = "subinput"/>
<input type = "submit" value = '提交' ></input>
</form>
</body>
<script>
var app = angular.module('myapp', []);
app.controller("TestController", function($scope){
$scope.cont = 0;
$scope.contClick = function () {
$scope.cont = $scope.cont+1;
};
});
app.controller("keypressController", function($scope){
$scope.keyin = 0;
$scope.keyClick = function () {
$scope.keyin = $scope.keyin+1;
};
});
app.controller("submitController", function($scope){
$scope.sub = '请输入';
$scope.subClick = function () {
$scope.sub = $scope.subinput;
};
});
</script>
</html>