Usually when I've seen this error, I haven't listed the dependency in my
code. An example would be testing a controller where the service is in
another module, but I haven't listed the dependency for the second module
in the first. For example
angular.module('MyModule', [ ])config( ......)
should have
angular.module('MyModule', ['service1Module'].config(......);
It will depend how you structured your code and project, but it is likely
somewhere you haven't injected the dependency to the service in the code
portion you are testing.
On Thursday, December 19, 2013 7:54:25 PM UTC-5, Matt O'Connor wrote:
>
> My services.js file was getting quite large so I decided it'd be best to
> split out the individual services into separate files (service1.js,
> service2.js, etc).
>
> Unfortunately, this broke all my unit tests. I'm no longer able to import
> the service dependencies into my tests. I'm seeing errors like this when I
> run my unit tests:
>
> Error: [$injector:unpr] Unknown provider: Service1Provider <- Service1
>
> I can't find any article on the web that addresses these issues. My app
> structure is pretty standard and OOTB, nothing really different from
> angular-seed <https://github.com/angular/angular-seed> (except of course
> the separate files for each service).
>
> Please let me know if you need more info.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.