Preslav's Thoughts and Ramblings

ionic2

  • 23 January 2016

    Injecting Services in Angular 2 and Ionic 2

    Create a service: import {Injectable} from 'angular2/core'; @Injectable() export class MyService { constructor(http: Http) { // initalize things } doSomething() { // do something } } Injecting the newly created service per component In vanilla Angular 2.0, as well as in Ionic 2 applications, you need to import the service class and add it to...