javascript - get all key values - localStorage angular -
my task simple. have text field button everytime press local storage updated text field value.i alredy managed when seek value shows nothing. if show me how , how display value(not id)
<div class="bar bar-header item-input-inset"> <label class="item-input-wrapper"> <i class="icon ion-ios7-search placeholder-icon"></i> <input ng-model="task" type="search" placeholder="new task"> </label> <button ng-click="go(task)" class="button button-clear"> add together </button> </div> the controller:
.controller('playlistsctrl', function($scope, $storage , playlistservice) { playlistservice.get123().then(function (playlists) { $scope.go = function(task) { $scope.playlists = playlists; var table = $storage('taskdata'); var dataarray= []; if (table.getitem("id") === null) { table.setitem('id',0); table.setitem('value',task); } else { table.setitem('id',table.getitem('id') + 1); table.setitem(table.getitem('id') + 1,task); } for(var = 1;i<=table.length;i++) { //dataarray[i] = dataarray[i] + tasks.getitem(table.getitem('id') + 1); //console.log(dataarray); console.log(table.getitem(i)); } //console.log(tasks.getitem(table.getitem('id') + 1)); } }); }) the info in localhost: key ||value taskdata {"2":"key value 2","id":1,"value":"key value 1"}
javascript angularjs
No comments:
Post a Comment