I’ve searched around but can’t find any definitive answers, so I’ll ask directly . I’ve seen 2 HTML JavaScript Panel syntax examples quoted for picking up the angular event when the time picker is adjusted on a dashboard. They are…
angular.element(‘grafana-app’).injector().get(‘timeSrv’).$rootScope.$on(‘refresh’, function(event, data) { runMyFunction(); });
…and…
angular.element(‘grafana-app’).injector().get(’$rootScope’).$on(‘refresh’, function(event, data) { runMyFunction(); });
Neither of these raise an error, but neither of them work in Grafana v5.4.0 (the version I have installed). Apparently, they DID work prior to v5.4, but I can’t test that right now.
Are either of these examples the correct syntax and approach? If not, what is the correct syntax and approach for Grafana v5.4? Is ‘refresh’ the correct angular event to watch for when the time picker values are changed? If not, what is?
Thanks
Mark