这里我有ng-repeat,它使用来自controller的值填充行数。每行包含三个标记为优秀,好的和坏的按钮。我想要做的是使用cval和button值将一个值保存到localstorage从每行三个按钮。选择一个应该保持激活按钮。
<div class="element" ng-repeat="cval in userOrderedValues track by $index">
<div class="values">
<p>{{cval}}</p>
</div>
<div class="btns">
<button class="button button-balanced" ng-model="selected" ng-click="saveStatus($index,cval,'good')" ng-class="{'active':val=='good' && current==$index}">excellent</button>
<button class="button button-amber" ng-model="selected" ng-click="saveStatus($index,cval,'ok')" ng-class="{'active':val=='ok' && current==$index}">good</button>
<button class="button button-assertive" ng-model="selected" ng-click="saveStatus($index,cval,'nw')" ng-class="{'active':val=='nw' && current==$index}">bad</button>
</div>
</div>
我如何将这些值保存到localstorage?这是codepen我为此做的
答案 0 :(得分:0)