How to use angular 2 service with Ionic 2?

前端 未结 3 1110
孤城傲影
孤城傲影 2020-12-03 06:41

I am new to Ionic 2. I read in angular 2 docs, that service needs to be injected while bootstrap application. But could not see any bootstrap thing while going through Ioni

3条回答
  •  醉酒成梦
    2020-12-03 07:13

    Search for Ionic Provider, in ionic instead of angular services we use ionic Provider, they provide the concept of Dependency Injection in Ionic.

    generate the ionic provider

    ionic generate provider 
    

    and then import the provider in the root page or the page in which it needs to be used

    and put in provider array

提交回复
热议问题