我試圖在iOS上創建angularJS應用程序,我想將複選框上的數據保存到本地存儲中。如何在AngularJS應用程序中將數組數據保存到本地存儲?
現在我的複選框的信息數組
$scope.cuisineList = [
{ text: "Asian Cuisine", checked: true },
{ text: "Cafe", checked: true },
{ text: "Chinese Cuisine", checked: true },
{ text: "Dessert and Bekery", checked: true },
{ text: "Dim Sum", checked: false },
{ text: "Ice Cream", checked: false },
{ text: "Japanese Cuisine", checked: false },
{ text: "Kiwi Cuisine", checked: false },
{ text: "Korean Cruisine", checked: false },
{ text: "Thai Cuisine", checked: false },
{ text: "Vegeterian Cuisine", checked: false }
];
和我的HTML5(我用標誌性的框架)
<ion-checkbox ng-repeat="item in cuisineList"
ng-model="item.checked"
ng-checked="item.checked"
ng-change="cuisineListChange()">
{{ item.text }}
</ion-checkbox>
當複選框什麼變化,它會執行cuisineListChange()
功能,我想將$scope.cuisineList
保存成。
請給我一個例子,如何使用本地存儲保存複選框。
謝謝。