Applying angular $watch on filter_bar not working


(Tarun Kumar) #1

I have got kibana filter_bar as below:
var queryFilter = Private(require('ui/filter_bar/query_filter'));
Now,
I wish to watch changes in queryFilter , but unexpectedly below watcher isn't working :-

var filterBar=queryFilter.getFilters();
$scope.$watch('filterBar', function(oldValue,newValue)
{
alert('filterBar changed');

console.log(oldValue); // resp getting undefined
console.log(newValue);
console.log(filterBar);
},true);

Watcher doesn't invoke even on filterBar gets updated on new filter being added , even though i have been using onjectEquality set true. Please help me on this ?


(Tarun Kumar) #2

Oh, here I got the solution ,

var queryFilter = Private(require('ui/filter_bar/query_filter'));
$scope.$listen(queryFilter, 'update', function () {
  alert("query Updated");
});

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.