Inject $http into NavbarExtension

Currently I'm developing Kibana 5.6.4 custom plugin to inject a button to discover, now the problem that I have is I want to inject an $http to the run method so that I could make an http request to backend

import { NavBarExtensionsRegistryProvider } from 'ui/registry/navbar_extensions';

function discoverControlProvider() {
 return {
   appName: 'discover',
   key: 'heiho',
   label: 'Heiho',
   run: (elm, prop) => {
       button.disable(); // Disable the button
       $http.get(); // This is what I'm trying to do
        
   }
 }
}

NavBarExtensionsRegistryProvider.register(discoverControlProvider);

Is that possible ? Also is it possible to disable the button upon making http request programmatically ?

I believe you should be able to grab a references to $http by simply passing it into the function (see https://www.w3schools.com/angular/angular_http.asp). Does that not work? And yes you should be able to disable the button.

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