# Using http without modifying html

**URL:** <https://forum.ionicframework.com/t/using-http-without-modifying-html/57205>\
**Category:** ionic-v3\
**Created:** [July 11, 2016, 4:33pm UTC](https://forum.ionicframework.com/t/using-http-without-modifying-html/57205 "2016-07-11T16:33:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luttik](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/luttik/32/101539_2.png) [@Luttik](https://forum.ionicframework.com/u/Luttik)\
**Post date:** [July 11, 2016, 4:33pm UTC](https://forum.ionicframework.com/t/using-http-without-modifying-html/57205/1 "2016-07-11T16:33:16Z")

</div>

Hi guys,

I can only find http requests where the http:Http object is given by ionic through a hook in the html. But ofcourse a lot of the background processes one uses don’t depend on the page that is opened. So I wondered if there is some way to get a http object without creating a hook in the html. (My best guess is that you can get it through the MyApp object, but im not sure).

Any help with this would be great.

Thanks,  
Daan

---

<div class="post-metadata">

**Author:** ![cklanac](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cklanac/32/100898_2.png) [@cklanac](https://forum.ionicframework.com/u/cklanac)\
**Post date:** [July 11, 2016, 7:11pm UTC](https://forum.ionicframework.com/t/using-http-without-modifying-html/57205/2 "2016-07-11T19:11:33Z")

</div>

I’m not sure if I’m following your question since I don’t know what you mean by…

> the http:Http object is given by ionic through a hook in the html.

That said, I think you want an @Injectable service which is injected into your app.

I think this answer on SO describes it succinctly.

> <https://stackoverflow.com/questions/34760422/how-to-use-angular-2-service-with-ionic-2/38036031#38036031>

---

<div class="post-metadata">

**Author:** ![Luttik](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/luttik/32/101539_2.png) [@Luttik](https://forum.ionicframework.com/u/Luttik)\
**Post date:** [July 12, 2016, 1:14pm UTC](https://forum.ionicframework.com/t/using-http-without-modifying-html/57205/3 "2016-07-12T13:14:39Z")

</div>

This is great, I didn’t know you could specify providers in the @Page and @Component tags.

For those who have the same issue:  
I now give the provider to the default @component in app.ts

`@Component({ template: '<ion-nav [root]="rootPage"></ion-nav>', providers: [HttpProvider] })`

and receive it in the constructor of MyApp.

```
export class MyApp
{
	...

	constructor(private platform: Platform, httpProvider: HttpProvider)
	{
	}
}

```

There was still some guessing involved about whether or not it would work but it seems that it does work. So that’s great.
