我如何使playerinit
從emptyseats
刪除所用的座位? 可以說seatid
是1,那麼它會從emptyseats
刪除seat: 1
?Angularjs的方式從陣列中刪除項目
vm.emptyseats = [
{seat: 1},
{seat: 2},
{seat: 3},
{seat: 4},
{seat: 5},
{seat: 6},
{seat: 7},
{seat: 8},
{seat: 9},
];
vm.playerinit = function(x) {
console.log("init user data");
var seatid = x.position;
// vm.emptyseats remove where seat: seatid
};
可能重複[按值刪除項目](http://stackoverflow.com/questions/3954438/remove-item-from-array-by-value) –