2014-03-29 30 views
2

我試圖迫使刷新編輯幾張唱片後,我的bindonce表,但我不知道如何bindonce refreshOn屬性使用。AngularJs - Bindonce力刷新使用refreshOn屬性

HTML代碼:

<tbody bindonce="filteredItems" refresh-on="refreshTaskList" ng-repeat="task in filteredItems | orderBy:sortingOrder:reverse"> 
<tr> 
<td><span bo-bind="task.serviceTypeName | isEmpty : 'None'"></span></td> 
    <td ><span bo-bind="task.percentageCompleted | isEmpty : 'Not Started'"></span></td> 
</tr> 
</tbody> 

我打電話這條線在我的控制器:

$scope.refreshTaskList(); 

另外,我試着給這很好,但沒有任何工程:

$scope.$broadcast('refreshTaskList'); 

能你有誰請幫助我如何以適當的方式使用它?

回答

3

將其更改爲:refresh-on="'refreshTaskList'"

例子:

<button ng-click="refresh()">Refresh table</button> 

$scope.refresh = function() { 
    $scope.$broadcast('refreshTaskList'); 
}; 

如果仍然不工作,你可能有一個不包含refresh-on屬性的版本。

演示:http://plnkr.co/edit/nYPDMRG4b1OtkMolEEDQ?p=preview

+0

好極了!我永遠不知道我們必須用單引號括起refreshTaskList。 – user972255

+0

對於那些希望bindonce的主分支沒有'在烤刷新on'屬性。你需要使用重新綁定調試分支https://github.com/Pasvaz/bindonce/tree/rebind-debug這似乎還有一些問題仍然是https://github.com/Pasvaz/bindonce/issues/42 – toxaq