了解 : angular $filter stateful

{{ abc | myFilter }}

angular.module('myStatefulFilterApp', [])
.filter('decorate', ['decoration', function(decoration) {

  function decorateFilter(input) {
    return decoration.symbol + input + decoration.symbol;
  }
  decorateFilter.$stateful = true;//当digest abc 没有更新,filter 就不会跑

  return decorateFilter;
}])
posted @ 2015-10-17 21:49  泉油  阅读(249)  评论(0编辑  收藏  举报
Web Design Johor Bahru Malaysia - Stooges