简体   繁体   English

更新过滤列表上的angular-chart.js

[英]Update angular-chart.js on filtered list

I'm fairly new to angular and I have come across a problem when adding angular charts js. 我对angular还是很陌生,在添加角度图表js时遇到了一个问题。 I have a list that filters on a searchtext. 我有一个过滤搜索文本的列表。 My problem is that i want my charts to update each time i filter the list. 我的问题是,我希望每次过滤列表时都更新图表。

What would be a good approach to tackle this problem? 什么是解决这个问题的好方法? I've tried to watch changes in the result (filteredresult below) of the list but i cant get it to work 我试图观察列表结果(下面的filteredresult)的变化,但我无法使其正常工作

<li ng-repeat="item in filteredresult = (result | filter:searchText)> 

You have to add listener: 您必须添加侦听器:

$scope.$watch('searchText',function(newValue,oldValue){
  //Some actions
})

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

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