为什么如果我把带有控制器的角度模块插入到函数中,安古拉杰就停止工作了?
(function() {
var app = angular.module("app", []);
app.controller("c1", function($scope){
$scope.name = "Hello World!";
});
});发布于 2017-11-17 20:28:33
您忽略了生平的代码(末尾是括号:() )。
下面有一个片段,你的样本更正了。
(function() {
var app = angular.module("app", []);
app.controller("c1", function($scope){
$scope.name = "Hello World!";
});
})(); //<< -- here!! See the closing ()<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="c1">
{{name}}
</div>
你可以在这里读到更多关于生活的内容:
https://stackoverflow.com/questions/47358271
复制相似问题