AngularJs - Bindonce force refresh using refreshOn attribute

痴心易碎 提交于 2019-12-12 20:36:47

问题


I am trying to force refresh my bindonce table after editing few records but I dont know how to use bindonce refreshOn attribute.

HTML Code:

<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>

I am calling this line in my Controller:

$scope.refreshTaskList();

Also, I tried calling this as well but nothing works:

$scope.$broadcast('refreshTaskList');

Can you anyone please help me how to use this in a proper manner?


回答1:


Change it to: refresh-on="'refreshTaskList'"

Example:

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

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

If it still doesn't work you might have a version that doesn't contain the refresh-on attribute.

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



来源:https://stackoverflow.com/questions/22727088/angularjs-bindonce-force-refresh-using-refreshon-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!