Hi!
I would like to ask question regarding to kibana plugin.
I am trying to detect the change every time the filter in status bar is changed for dashboard.
I wrote the code in the controller as below but the result is not I have expected.
$scope.$watch(getAppState, function (appState) {
$scope.state = appState;
var type = typeof($scope.state)
var length = $scope.state.filters.length
$scope.length = "Type : " + type + " Len : " + length
});
I wrote the template as below.
<div ng-controller="PluginController">
<!-- <h1 ng-repeat="i in bucket">{{i.label}} , {{i.value}}</h1> -->
<h3>Current timerange minimum : {{min._d}}</h3>
<h3>Current timerange maximum : {{max._d}}</h3>
<h3>Current : {{state['filters']}} Length : {{state['filters'].length}}</h3>
<h3>Length : {{length}}</h3>
</div>
In the template , Length : {{state['filters'].length}} , detects the number of filters properly but Length : {{length}} does not.
I am referencing the same object but I dont know why but results differently.
May I ask why this is happening?
I first tried
$scope.$watch('state.$newFilters', function (filters) { });
but it only picked up when the filter was initially added.
So I am now trying using watching appState.