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

Doesn't load angular-cache in app.run.js #244

Open
ghost opened this issue Sep 29, 2016 · 1 comment
Open

Doesn't load angular-cache in app.run.js #244

ghost opened this issue Sep 29, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 29, 2016

Hi,

I am attempting to implement angular-cache into an angular 1.4.3 app. We are attempting to use angular-cache version 4.6.0. but everytime we run the app build it produces the following error:

Uncaught Error: [$injector:unpr] Unknown provider: angular-cacheProvider <- angular-cache
http://errors.angularjs.org/1.4.3/$injector/unpr?p0=angular-cacheProvider%20%3C-%20angular-cache

The code I am using is as follows:

angular.module("testApp").
        run(init);

    init.$inject = ["user", "angular-cache", "$ionicLoading","$ionicPopup", "$state", "$ionicHistory",
                    "AuthService","StoreHierarchyFactory", "$rootScope", "OrganisationService"];

    function init(user, CacheFactory, $ionicLoading, $ionicPopup, $state,
                   $ionicHistory,AuthService,StoreHierarchyFactory, $rootScope, OrganisationService) {

I have linked to the angular-cache.js file in my index.html document as follows:

<script src="lib/ionic/ionic.bundle.js"></script>
<script src="lib/moment.min.js"></script>
<script src="lib/angular-cache.js"></script>

I am well and truly stumped and almost one laptop down. Do you have any suggestions on how we can crawl over the first hurdle.

Cheers.

@jmdobry
Copy link
Owner

jmdobry commented Sep 30, 2016

You need to make angular-cache a dependency of your module, e.g.

angular.module('testApp', ['angular-cache'])
  .run(['CacheFactory', function (CacheFactory) {
    // ...
  }]);

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

1 participant