# Inject $http into NavbarExtension

**URL:** <https://discuss.elastic.co/t/inject-http-into-navbarextension/110933>\
**Category:** Kibana\
**Created:** [December 9, 2017, 2:55pm UTC](https://discuss.elastic.co/t/inject-http-into-navbarextension/110933 "2017-12-09T14:55:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetpumz](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@jetpumz](https://discuss.elastic.co/u/jetpumz)\
**Post date:** [December 9, 2017, 2:55pm UTC](https://discuss.elastic.co/t/inject-http-into-navbarextension/110933/1 "2017-12-09T14:55:27Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Stacey\_Gammon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stacey_gammon/32/14025_2.png) [@Stacey\_Gammon](https://discuss.elastic.co/u/Stacey_Gammon)\
**Post date:** [December 11, 2017, 8:51pm UTC](https://discuss.elastic.co/t/inject-http-into-navbarextension/110933/2 "2017-12-11T20:51:00Z")

</div>

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](https://www.w3schools.com/angular/angular_http.asp)). Does that not work? And yes you should be able to disable the button.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 8, 2018, 8:51pm UTC](https://discuss.elastic.co/t/inject-http-into-navbarextension/110933/3 "2018-01-08T20:51:10Z")

</div>

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