Note: This is not a duplicate, the duplicate mentioned does not even remotely mention the same function. Plus this also refers to how angularjs works.
So in angularjs, I recently had to make a controller and then inject data.
I am wondering why I had to do this:
function myController ($window) {
var ctrl = this;
return ctrl;
}
myController.$inject = ['$window'];
why can't I do this instead? What's the difference between the two?
function myController ($window) {
var ctrl = this;
ctrl.$inject = ['$window'];
return ctrl;
}