我有以下的html。如何讓Angular從控制器內更新Ui
<div ng-controller="CustCtrl">
<table class="table table-condensed">
<thead>
etc.
</thead>
<tbody>
<tr ng-repeat="customer in customers" data-cust-id="{{customer.Id}}">
<td>
<button ng-model="Id" tracking-{{customer.Tracking}} ng-click="startTrackingCustById(customer.Id)">
</button>
</td>
etc.
</tr>
</tbody>
</table>
所以按鈕有一個數據綁定到customer.Tracking值是真或假的類。當點擊按鈕時,startTrackingCustById()方法被成功調用,客戶對象中的客戶對象成功更改,如customer.Tracking = true。
但按鈕類沒有更新。我錯過了什麼?
什麼是'ng-model =「Id」'? – SET 2013-03-09 22:19:45
看起來你缺少'class':'class =「tracking - {{customer.Tracking}}' – 2013-03-09 22:30:44