0
我剛剛發現我對角模塊一無所知。AngularJS中特定於模塊的常量?
con
在以下指令中的值是baz
,這意味着在定義常量(即它不依賴於模塊)的位置無關緊要。
有沒有辦法讓模塊特定的常量?
angular.module('amodule', [])
.constant("foo", "bar")
.directive('helloWorld', function (foo) {
return {
link: function(scope) { scope.con = foo },
restrict: 'E',
scope:{
name:'bind'
},
template: '<span>{{con}}</span>'
}
})
angular.module('stuff', [])
.constant("foo", "baz")
angular.module('HelloApp', ['amodule', 'stuff'])
哦,手動命名空間它是 – fusio 2014-09-10 20:40:00