Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS - Can a module and a directive have the same name?

For example:

angular.module('someName', []).

    directive('someName', function() {
        ...
    });

Can this potentially cause problems in AngularJS? Should this be avoided?

like image 965
Marc M. Avatar asked Apr 10 '14 19:04

Marc M.


1 Answers

A module and a directive can have the same name. You could even include a service, factory, or provider with the same name as the module, but not the same name as one another.

The reason you can use the same name for the directive as the module is because the modules and their names are stored in one object and the directives and their names are stored in another object.

like image 120
James Avatar answered Oct 22 '22 07:10

James