是否可以在AngularJS中爲ng模型添加增量標識符?AngularJS添加增量值
我正在遍歷項目列表,並需要和循環中每個項目的ng-model =「」屬性的增量值,或者如果有更簡單的方法,我希望聽到它。
什麼我目前正在:
<li ng-repeat="recipe in recipes">
<label for="cost_ingredient_{{recipe.ingredient_id}}" style="font-size: 16px;">{{recipe.ingredient}}</label>
<input ng-model="{{recipe.model_name}}" name="formcost_ingredient_{{recipe.ingredient_id}}" type="number" id="cost_ingredient_{{recipe.ingredient_id}}" min="0" step="0.01" value="0" />
</li>
我試圖用一個指令,這樣做,但是當我稱之爲「FORMDATA」在控制器中,沒有一個模型指標上來。
我需要將這些信息作爲表單提交的一部分返回到流程中的下一頁。這將部署到Android,所以我想只是將其添加到window.sessionStorage,因爲我只需要這一次每次用戶運行我的應用程序。