码迷,mamicode.com
首页 > Web开发 > 详细

angularjs中ng-controller中绑定对象

时间:2017-01-04 07:50:18      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:char   prot   round   meta   har   input   options   ret   div   

<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
.red{ background:red;}
.yellow{ background:yellow;}
</style>
<script src="angular.min.js"></script>
<script>

/*var m1 = angular.module(‘myApp‘,[]);
m1.controller(‘Aaa‘,[‘$scope‘,function($scope){
$scope.text = ‘hello‘;

}]);*/

var m1 = angular.module(‘myApp‘,[]);
m1.controller(‘Aaa‘,[‘$scope‘,FnAaa]);

function FnAaa($scope){
}
FnAaa.prototype.num = ‘123‘;
FnAaa.prototype.text = ‘hello‘;
FnAaa.prototype.show = function(){
return ‘angularJS‘;
};

</script>
</head>

<body>
<!--<div ng-controller="Aaa">
<input type="text" ng-model="text" ng-model-options="{updateOn : ‘blur‘}">
<div>{{text}}</div>
</div>-->
<div ng-controller="FnAaa as a1">
<div>{{a1.text}}:{{a1.show()}}</div>
</div>
</body>
</html>

angularjs中ng-controller中绑定对象

标签:char   prot   round   meta   har   input   options   ret   div   

原文地址:http://www.cnblogs.com/songyunxinQQ529616136/p/6247215.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!