If we register the controller in the module

angular.module('app.module1').controller('thisNameController', controller) function controller(){} 

and get access to it through

 angular.module('app.module1').config(configLoad) ... .state{ controller: 'thisNameController', controllerAs: 'vm' } 

Should the controller name be unique within this module or the entire application? For example, can other controllers have controllers with the same name or will the one that will be registered last be called?

    1 answer 1

    The uniqueness of the name must be at the level of the entire application .

    Otherwise, the last definition will be used.

    The only case when several functions of the same name are executed are directives.

    You can have several directives with the same name and they are all independent of each other. But this has nothing to do with modules.

    • Not very logical, but thanks for the answer. We will know! - mistbow
    • @mistbow, not why, with controllers / services, etc. everything is simple - as a result, there are simply no modules, everything is in the single most important module to which everything is connected. With directives, yes, all is not all obvious - Grundy