1
我需要添加到「順序列表」元素,不僅通過點擊按鈕,而且還通過用戶通過輸入表單輸入。 如何使用從控制器中的$ click函數派生的var?在Angularjs控制器中使用jquery函數的臨時變量
CODE
var app = angular.module('myApp', []);
app.controller('POSController', function ($scope) {
var x=choose;
$scope.food = {
pizza : {count: 1, id:2, detail: "Brick Oven Pizza", price: 15},
donut : {count: 3, id:3, detail: "Glazed Donut",price: 8},
tortilla : {count: 1, id:4, detail: "Tortilla Chips",price: 3},
burger : {count: 1, id:5, detail: "Burger",price: 3},
samosa : {count: 1, id:6, detail: "Delicious Samosas",price: 3},
coldcoffee : {count: 1, id:7, detail: "Cold Coffee",price: 2},
hotcoffee : {count: 1, id:8, detail: "Hot Coffee",price: 2},
coke : {count: 1, id:9, detail: "Coke",price: 2},
dietcoke : {count: 1, id:10, detail: "Diet Coke",price: 2},
pepsi : {count: 1, id:11, detail: "Pepsi",price: 2},
incognita: {count: 1, id:12, detail: x, price: 2},
};
});
我需要臨時值分配到所述陣列的最後一個元素的變量x,使得對於每個輸入它具有新的值。 我附上我的普拉克http://plnkr.co/edit/CoSAgGAco016pEIcRtLi?p=preview