there is such a module

(function () { 'use strict'; angular.module('lss-angular-country',[]) .constant('COUNTRIES',[ {code:'AF',name:'Afghanistan'},{code:'AL',name:'Albania'},{code:'DZ',name:'Algeria'}..... 

there further array continuation. This module is included in the config of the app.js file and the file in index.html

This is app.js

 'use strict'; angular .module('app', [ 'config', 'ngResource', 'ngSanitize', 'ngMaterial', 'angular.filter', 'ui.router', 'ui.calendar', 'lss-angular-country', 

Q: How do I get to the COUNTRIES from the controller? on the similarity:

 (function () { 'use strict'; /* jshint latedef:nofunc */ angular.module('app') .controller('agentsRegisterCtrl', function ($scope) { console.log(COUNTRIES); // <--------------------- 

    1 answer 1

    You must use dependency injection by adding a constant to the parameters

     .controller('agentsRegisterCtrl', function ($scope, COUNTRIES) { console.log(COUNTRIES); 
    • Thank you! I thought that it was necessary to inject by the name of the module - it was shoved, it did not work out that way. - Igor Kalamurda
    • @IgorKalamurda, modules need to be pushed in dependence of modules, and in services controllers, etc. you can connect only the same services, controllers, etc. - Grundy