Lzarra
Lzarra

Reputation: 3

angular.module requires doesn't work

I'm new with angularjs and I'm having some problems with the controllers. When I try to put something in the angular.module I only can specify the name, if I put something in the requires part all the page stop working. For example: If I put angular.module('name',[]) it doesn't work but if I put angular.module('name') it works properly. Somebody knows why is it?

Upvotes: 0

Views: 133

Answers (1)

Chandermani
Chandermani

Reputation: 42669

This statement

angular.module('name',[])

creates a module, whereas this statement loads the module

angular.module('name')

The first statement should be used once to define the module with dependencies. After that the second format should be used.

If you use the first syntax again this leads to redefining of module and existing registration on the module are lost.

Upvotes: 1

Related Questions