angularjs controller中使用filer

来源:互联网 发布:著名网络暴力事件 编辑:程序博客网 时间:2024/06/06 05:54

我们知道在页面中使用filter的格式入如下:

<legend>{{data.nodeId | filterMonitorQueryTable:monitorQueryParam:queryTypeNode}}</legend>

但是在controller中如何使用呢?

1、在controller注入$filter依赖

2、$filter('filterName')(‘filterParam’);如:

$filter('filterMonitorQueryTable')(data.nodeId, $rootScope.monitorQueryParam, $rootScope.queryTypeNode);

其中filterMonitorQueryTable是自己定义的filter

阅读全文
0 0