marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

Angular Local Storage #95

Closed hawkwind2 closed 9 years ago

hawkwind2 commented 9 years ago

Hi marcoslin, I'm getting an error when trying to inject localStorageService Source file taken from http://gregpike.net/demos/angular-local-storage/demo/demo.html This is the error I'm getting: Error: [$injector:unpr] http://errors.angularjs.org/1.2.20/$injector/unpr?p0=localStorageServiceProvider%20%3C-%20localStorageService

Any info on that?

hawkwind2 commented 9 years ago

I've tried to add ngCookies, but got an error on that as well:

GET http://localhost:64241/scripts/lib/angularAMD.min.map 404 (Not Found) localhost/:1 GET http://localhost:64241/scripts/lib/angular-sanitize.min.js.map 404 (Not Found) localhost/:1 Error: [$injector:unpr] http://errors.angularjs.org/1.2.20/$injector/unpr?p0=ngCookiesProvider%20%3C-%20ngCookies at Error (native) at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:6:450 at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:36:202 at Object.c as get at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:36:270 at c (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:34:305) at d (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:35:6) at Object.instantiate (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:35:165) at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js:67:421 at link (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular-route.min.js:7:248)

angular.js:9997

marcoslin commented 9 years ago

Can you setup a jsfiddle or plunker that I can take a look?

hawkwind2 commented 9 years ago

Thanks, well I have tried to do that and copy the necessary files: http://plnkr.co/edit/O7Czas9ht9LYVG0KBCPf HTH Can you please have a look, Localstorage still doesn't work for me..am I missing something?

marcoslin commented 9 years ago

There was quite a few things wrong with the plunker and here is the working version: http://plnkr.co/edit/aNkXJgHNTUvNJrlSAIRt

Few issues:

  1. You load bunch of packages such as angular-cookies but you never specified the dependency. RequireJS does not guarantee the loading order of packages in the array following the define statement.
  2. You app.js was simply wrong and you didn't return anything at the end
  3. You were using mix and match of different version of angular, and using a very old version of angularAMD

Please take a look at the documentation and sample code provided.

hawkwind2 commented 9 years ago

@marcoslin Thank you very much for your help, I will check all of that.