I am trying to modularize my code and moved controller in a separate file that uses same module. But, it does not load, I made sure the load order is correct.
// app.js
angular.module("app", []);
// LoginCtrl.js
angular.module("app", []).controller("LoginCtrl", function()
{
//doSomeThing
});
If I do var app = angular.module in first file and use the same variable in other files, it works.
// app.js
var app = angular.module("app", []);
// LoginCtrl.js
app.controller("LoginCtrl", function()
{
//doSomeThing
});
If I move all code in one file and use angular.module separately for each component, it works.
// app.js
angular.module("app", []);
angular.module("app", []).controller("LoginCtrl", function()
{
//doSomeThing
});
Am I missing something?