Answer the question
In order to leave comments, you need to log in
What is the difference in two expressions in angular?
I saw such an example in the dock, and I can’t understand why wrap everything in an array and pass the first two elements, which are then passed to the function parameters if it works without it:
// Пример из доки
app.controller('authCtrl', ['$rootScope', '$location', function($rootScope, $location) {
// Код
}]);
// Мой пример
app.controller('authCtrl', function($rootScope, $location) {
// Код
});
Answer the question
In order to leave comments, you need to log in
The first option will work everywhere.
The second option, if $inject is not used, will break after minification.
That's it in a nutshell =)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question