Amy Glenn Amy Glenn - 3 months ago 83
AngularJS Question

Uncaught Error: [$injector:unpr] Unknown provider: $localstorageProvider <- $localstorage

Was using ionic, in my app.js I do

angular.module('starter', ['ionic', 'starter.controllers','ngCordova'])

.run(function($ionicPlatform, $localStorage , $cordovaPush) {
$ionicPlatform.ready(function() {
console.log($localStorage);
})
})


But I got error of
Uncaught Error: [$injector:unpr] Unknown provider: $localstorageProvider <- $localstorage


Any thought? so strange..

Answer

Change

$localstorage

to

$window.localStorage //S is capitalized

And inject the $window dependancy in your run function.