angularjs defining services for the same module in different files

后端 未结 2 1260

I have two files in which I define services in my angular app, but when I try to use them both in my directive, I get an error saying the service provider is not found for w

2条回答
  •  无人及你
    2020-12-29 08:53

    This is possible, however will be error prone, hence not recommended

    Make small modification to what you are already doing

    Just do not re-declare the module variable in other files other than service1.js or put the module definition to a file of its own and include these JS file in the order of Module.js, services.js, directive.js then it will work

提交回复
热议问题