Thats not really true...

.controller('TakeGPSData', ['$scope', '$http', function(s, h) 

Will work just as well, so will 

.controller('TakeGPSData', ['$scope', '$http', function() {  
  var scope = arguments[0];
  var httpService = arguments[1];
}]);

It's instructions for the IoC Container, which we unfortunately can't 
really do in any other ways in JS.

>From my experience with teams adopting angular, I would not recommend the 
use of ng-annotate for new angular developers, they need to learn how and 
why it works this way.
Remove the magic from the equation, so to speak...

Alternatively always use the explicit way in ng-annotate, you will have to 
use it eventually as ng-annotate won't cover all cases out of the box where 
frameworks may provide inject-able functions.
That will also give you a "demystification" of why it works which helps new 
people to understand... 

On Monday, September 22, 2014 1:57:45 PM UTC+2, Kyle Cordes wrote:
>
> On Sunday, September 21, 2014 6:13:06 AM UTC-5, Christoph Roth wrote:
>>
>> Hi,
>>
>> I am learning Angular currently, so I am an expert in no way, but this 
>> looks simply as if arguments are switched:
>>
>> .controller('TakeGPSData', [ '$http','$scope', function($scope, $http) 
>>
>> should be:
>>
>> .controller('TakeGPSData', ['$scope', '$http', function($scope, $http) 
>>
>>>
>>>
>
> Beginner, and not-so-beginners, get this wrong unreasonably often, and it 
> is a form of duplication (i.e. almost always bad).
>
> At work we do not use of the ["something", function(something){}] syntax 
> in real projects. We reject it in code review. There is a tool 
> (ng-annotate?) to add this syntax in a build process to survive 
> minification of course - automatically, without imposing on human 
> developers.
>
> Kyle Cordes
> Oasis Digital
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to