This is undoubtedly one of the trickiest issues to encounter when developing a project with AngularJS:
ionic.bundle.js:26799 Error: [$injector:unpr] Unknown provider: fifoServiceProvider <- fifoService <- FifoController
http://errors.angularjs.org/1.5.3/$injector/unpr?p0=fifoServiceProvider%20%3C-%20fifoService%20%3C-%20FifoController
at ionic.bundle.js:13443
at ionic.bundle.js:17793
at Object.getService [as get] (ionic.bundle.js:17946)
at ionic.bundle.js:17798
at getService (ionic.bundle.js:17946)
at injectionArgs (ionic.bundle.js:17970)
at Object.instantiate (ionic.bundle.js:18012)
at $controller (ionic.bundle.js:23417)
at Object.self.appendViewElement (ionic.bundle.js:59908)
at Object.render (ionic.bundle.js:57901)
Encounter this problem, have no hint at all, look for a problem all have no way to start, headache unceasingly.
before we talk about the solution, let’s look at the angular.module function:
angular.module('MyApp',[])
In a SPA project, we can actually add more than one module. The module’s dependencies are then declared in that bracket.
This type of dependent function is called a module declaration.
angular.module('MyServices',['OtherService'])
He also USES it in another way, without the parenthesis:
angular.module('MyServices')
This method without brackets is used to refer to the module. So, the same module, of course, we only need to declare once OK:
angular.module('MyApp',['MyControllers','MyServices','MyDirectives']);
angular.module('MyControllers',[]);
angular.module('MyServices',[]);
angular.momdule('MyDirectives'[]);
So, angular.module(“,[]) is used to declare a module, equivalent to the setter function of an Angular module. Angular.module (), which refers to a module, on which we can add our own definitions.
So I check the code. Almost every service has an Angular. Module (“,[] “) in it. This is used to declare modules. Specially here to write, record down, hope to have encountered the same problem can adopt, this pit is really deep…