javascript - Angularjs localStorage: Cannot read property '$default' of undefined -


i'm working ionic , angularjs , need save data in localstorage installed ngstorage bower , imported in index.html, have got error when initialize $localstorage

typeerror: cannot read property '$default' of undefined 

here how initilized it

$localstorage = $localstorage.$default({   carrello: [] }); 

here method add data localstorage

$scope.adddisco = function(index, carrello){     $scope.selecteddisco = $scope.listadischi[index];      storageservice.add($scope.selecteddisco); } 

and here factory

app.factory ("storageservice", function ($localstorage) {  var _getall = function () {   return $localstorage.things; };  var _add = function (thing) {   $localstorage.things.push(thing); }  var _remove = function (thing) {   $localstorage.things.splice($localstorage.things.indexof(thing), 1); }  return {     getall: _getall,     add: _add,     remove: _remove   }; }) 

i work $window.sessionstorage never worked type of data storage every ideas welcome. ty


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -