Angularjs error Unknown provider

后端 未结 2 1977
死守一世寂寞
死守一世寂寞 2020-12-16 09:49

I\'m trying to display the configured values author and version in angular value service in html page.Version code is displayed fine but not the au

相关标签:
2条回答
  • 2020-12-16 10:11

    Make sure you are loading those modules (myApp.services and myApp.directives) as dependencies of your main app module, like this:

    angular.module('myApp', ['myApp.directives', 'myApp.services']);
    

    plunker: http://plnkr.co/edit/wxuFx6qOMfbuwPq1HqeM?p=preview

    0 讨论(0)
  • 2020-12-16 10:13

    bmleite has the correct answer about including the module.

    If that is correct in your situation, you should also ensure that you are not redefining the modules in multiple files.

    Remember:

    angular.module('ModuleName', [])   // creates a module.
    
    angular.module('ModuleName')       // gets you a pre-existing module.
    

    So if you are extending a existing module, remember not to overwrite when trying to fetch it.

    0 讨论(0)
提交回复
热议问题