I have problem when define angularjs module in multi place
angular.module('ty', [])
.directive('v1', function() {
return{
restrict: "E",
template: '<div>1</div>'
};
});
angular.module('ty', [])
.directive('v2', function() {
return{
restrict: "E",
template: '<div>2</div>'
};
})
This problem can solve by define a variable like this
var a = angular.module('ty', []);
a.directive('v1', function() { ...
a.directive('v2', function() { ...
My question is: Can we define module in multi place without global variable ?
angular.module('myModule', [])will create the modulemyModuleand overwrite any existing module namedmyModule. Useangular.module('myModule')to retrieve an existing module." -- docs.angularjs.org/guide/module