Reputation: 2003
I'm embedding js into an html text panel, and would like to be able to reference the current time. However grafana is written in angular so there is a massive amount of abstraction and hiding of data; thus accessing the data I want has proven to be a mess.
The following works, but is probably all sorts of wrong to someone who knows angular at all. So is there a better way?
angular.element($(".grafana-menu-refresh > a")).scope().ctrl.timeSrv.timeRange()
Upvotes: 1
Views: 622
Reputation: 618
Try:
var rng = angular.element('grafana-app').injector().get('timeSrv').timeRange();
Upvotes: 2