执行后,出不来结果
老师您好,我按照您写的代码,来执行程序,界面是空白,没有出来结果。是应为angularjs版本的问题?还是其他的原因
老师您好,我按照您写的代码,来执行程序,界面是空白,没有出来结果。是应为angularjs版本的问题?还是其他的原因
2014-11-20
附上另外一种调用控制器的方法
<body ng-app="myApp">
<div ng-controller="CommonController">
<button ng-click="commonFn()">common</button>
</div>
<div ng-controller="Controller1">
<p>{{greeting.text}}, Angular.</p>
<button ng-click="control1()">controller1</button>
</div>
<script src="js/Angular.js"></script>
<script src="style.js"></script>
<script>
var app = angular.module("myApp", []);
app.controller("CommonController", function($scope){
$scope.commonFn = function(){
alert("common");
};
});
app.controller("Controller1", function($scope){
$scope.greeting = {
text:"Hello"
};
$scope.control1 = function(){
alert("Controller1");
}
});
</script>
</body>
举报