I'm new to Angular, I have a simple question to relay to LocalStorage in AngularJS. I have a json file to get data to the DOM and I already have the LocalStorage.getItem working and display on the console.
Right Now I need to figure out how to get that LocalStorage into the Dom after clicking a simple button.
This is my controller for the file:
angular.module('stock').controller('checkListController', [
'$http',
'checkListService',
function checkListController($http, checkListService) {
'use strict';
var self = this;
this.checkList = [];
$http.get('api/checklist.json').then(function (result) {
self.checkList = result.data.items;
});
this.checkListMissing = [];
$http.get('api/checklist-missing.json').then(function (result) {
self.checkListMissing = result.data.items;
});
var addList = [];
var missingItemList = [];
this.addItem = function (item) {
addList.push(item);
localStorage.setItem('item', JSON.stringify(addList));
missingItemList = addList;
console.log(missingItemList);
}
}
]);
Does this makes any sense? Thank you all