我希望使用 ngStorage 存储一个数组以满足持久数据的需求。这是我的代码:
.factory("items", function () {
var items = {};
items.data = [];
return items;
})
.controller('ItemsController', function($scope,items) {
$scope.items = items;
$scope.addItem = function (id,item,size,price,quantity) {
items.data.push({id,item,size,price,quantity});
}
})
我需要将 items 数组存储在 ngStorage