How to store toggle settings w/ localstore?


#1

Hey there,
I’m new to Ionic since 2 weeks ago and have some serious problems with the local store process. I want to save the toggle settings from my funnels page. I’ve got the toggles via ng-repeat out of my controller. But I’m too damn stupid to reproduce the local storage tut on my project.

My ion-toggle:

<ion-toggle class="item-icon-left toggle-balanced" ng-repeat="item in plList" ng-model="item.checked" ng-change="?">
            <i class="icon {{item.icon}}"></i>
            {{item.text}}
</ion-toggle>

My controller:

.controller('FunnelCtrl', function($scope) {
$scope.plList = [{
    text: "JavaScript",
    icon: "ion-social-javascript",
    checked: false
}, {
    text: "Python",
    icon: "ion-social-python",
    checked: false
}
?

So, I have no idea how to write the function ‘window.localStore.setItem(key, value)’. I really don’t know what I’ve to fit in as key and how to fetch the value of the correct toggle. I don’t want to build each toggle for it’s own. Is there a possibility to use the ng-repeat in combination with local data storage?


#2

Is it possible to handle all toggles in one object? and how I have to set the key for each one?