I am new to angular js, I am using local storage in my project.
I want to store the data in local storage dynamically.
What is the best way to achieve this?
My function is :
$scope.saveItem=function(){
var dataobj= { 'itemCode':vm.person1.selected.itemCode,
'itemName':'name',
'qty':'1',
'price':'2',
'total':1 * 2,
'comment':'comment',
};
localStorageService.set('order',dataobj);
}
I have entered the static data here but this data will be dynamic when I add the new item and I want to keep previous data and store newly entered data in local storage.