I am new in this field. When I read some code like
https://plnkr.co/edit/YeahrG28bT2izX8gMKor?p=preview
I discover that If I don't put 'myApp.dashboard','myApp.value'
in angular.module('myApp', ['myApp.dashboard','myApp.value']);
It won't work.
If I just write like this:
(function() {
angular.module('myApp', []);
})();
(function() {
angular.module('myApp.dashboard', ['myApp.value']);
})();
(function() {
angular.module('myApp.value', []);
})();
It also doesn't work as well.
Could you tell me what's the dot here mean and why angular.module('myApp.dashboard', ['myApp.value']);
doesn't work?
Sorry, this code is really in a mess and I haven't done much about it, just for test.
(function() {
angular.module('myApp', ['myApp.dashboard','myApp.value']);
})();
(function() {
angular.module('myApp.dashboard', []);
})();
(function() {
angular.module('myApp.value', []);
})();
(function() {
'use strict';
angular.module('myApp.value').factory('whichToShow', function() {
alert("running2");
var logged = true;
return {
getVar: function() {
return logged;
},
setVar: function(value) {
logged = value;
}
};
});
})();
(function() {
'use strict';
angular.module('myApp.dashboard').controller('mainControl', mainControl);
mainControl.$inject = ['whichToShow'];
alert("running1");
function mainControl(whichToShow) {
this.logged = whichToShow.getVar();
alert("this.logged");
}
})();
Supplement: I shouldn't ask second question, I made one mistake other place, sorry.