1

There are a lot of unknown provider questions on stack overflow, and I've looked at a couple of them so far, but none of them solve my problem. If I find one that does, I'll remove this question.

This is what my code looks like, ExpenseTracker is an angular.module:

ExpenseTracker.run(["$provide", "$q",function($provide, $q){
    console.log("define gapi service")
    window.gapiinit = function($q, $provide){
        var gapiPromise = $q.defer().promise;
        var ROOT = 'https://localhost:1800/_ah/api';
        gapi.client.load('expensetTackerapi', 'v1', function() {
                gapiPromise.resolve(gapi);
},      ROOT);
        $provide.factory("gapi",function(){
            return gapiPromise
        })
    }
}]

the error looks like this:

Uncaught Error: [$injector:unpr] Unknown provider: $provideProvider <- $provide
http://errors.angularjs.org/1.2.7/$injector/unpr?p0=%24provideProvider%20%3C-%20%24provide

1 Answer 1

5

$provide is a provider, you can only inject $provide in app.config method, not in .run method.

Sign up to request clarification or add additional context in comments.

2 Comments

If I'm trying to use the $provide in a test fixture. What's the proper way of injecting $provide in this case?
@Blake $provide methods are directly available on app variable (returned by angular.module()). I don't know if this is what you wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.