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