Reputation: 2076
I am new to AngularJS. I have been reading the excellent book Mastering Web Application Development with AngularJS by Pawel Kozlowski and Peter Bacon Darwin. However, I am still a bit fuzzy on some concepts, so I have decided to go through their sample application line by line to try and get a better understanding of how AngularJS is used in a real-world app.
In some places I see notation that I can't see explained in their book, nor in the API docs. I am wondering if anyone can shed some light on this, as seen in the /client/src/app/projectsinfo/projectsinfo.js file of the project linked to above:
angular.module('projectsinfo', [], ['$routeProvider', function($routeProvider){
...
}]);
My understanding of the angular.module method is that it accepts three arguments:
However, in the above example, for the third argument an array is being provided, with the first element in the array being a string (I am assuming a provider?), followed by a function. Can anyone explain what is going on here?
Upvotes: 5
Views: 4836
Reputation: 388316
The syntax of angular.module() is:
angular.module(name, [requires], configFn);
where:
name
is the name of the module,requires
is an optional list of modules on which this module depends, andconfigFn
is a function used to configure the module.Here the configFn
can be a function or a array:
The code in the said files seems to be fine.
Upvotes: 12