Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: [$injector:unpr] Unknown provider: aProvider #37

Closed
niiamon opened this issue Apr 4, 2014 · 5 comments
Closed

Uncaught Error: [$injector:unpr] Unknown provider: aProvider #37

niiamon opened this issue Apr 4, 2014 · 5 comments

Comments

@niiamon
Copy link

niiamon commented Apr 4, 2014

When I build with grunt, everything builds properly but when I try to run the generated code, the page fails to load and all I see is a white screen.

I noticed that there's this error in the console:

Uncaught Error: [$injector:unpr] Unknown provider: aProvider <- a <- $http <- $templateFactory <- $view <- $state

That is most likely due to minification. The weird thing is that when I generate a project and I build without any modifications to the code, everything works well but in my real project which has all my code, it breaks.

What would be a good way to fix this?

@diegonetto
Copy link
Owner

What version of the generator are you on? Run yo from the command line and it should list the version number.

@oori
Copy link
Contributor

oori commented Apr 8, 2014

Let me guess - you use "ui-sref-active" ? if so, it's an old ui-router minification bug.
see: ionic-team/ionic-framework#941

@diegonetto
Copy link
Owner

No response from @niiamon in over a month. Feel free to re-open a new issue if this problem persists.

@niiamon
Copy link
Author

niiamon commented May 15, 2014

Apologies. Should have sent in a response regarding what I found. The issue was with code minification. I was using the wrong syntax to enable code minification to be done successfully. Using syntax such as:

factory('alert', ['$window', function($window) {
(declaring the function in an array along with the function's dependencies)

instead of

factory('alert', function($window) {

fixed my problem.

@mautematico
Copy link

Gracias, @niiamon 👍
This fixed same issue on my team's app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants