angular.js--demo2-----声明局部控制器controller

<!doctype html>
<html ng-app="HelloAngular">
<head>
<meta charset="utf-8">
</head>
<body>
<div ng-controller="helloAngular">
<p>{{greeting.text}},angular-demo2</p>
</div>
</body>
<script src="js/angular-1.3.0.js"></script>
<script src="HelloAngular_Module.js"></script>
</html>

 

HelloAngular_Module.js

var myModule= angular.module("HelloAngular",[]);
myModule.controller("helloAngular",['$scope',
function hell ($scope){
$scope.greeting = {
text:'你好'
};
}

]);

posted @ 2016-10-13 20:45  江山一族  阅读(139)  评论(0编辑  收藏  举报