简体   繁体   English

AngularJs-Bindonce使用refreshOn属性强制刷新

[英]AngularJs - Bindonce force refresh using refreshOn attribute

I am trying to force refresh my bindonce table after editing few records but I dont know how to use bindonce refreshOn attribute. 我试图在编辑一些记录后强制刷新我的bindonce表,但是我不知道如何使用bindonce refreshOn属性。

HTML Code: 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>

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? 有人可以帮我如何正确使用它吗?

Change it to: refresh-on="'refreshTaskList'" 更改为: 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. 如果仍然无法使用,则可能是您的版本不包含refresh-on属性。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM