Created
May 14, 2016 06:50
-
-
Save ctran/97247c30189237b814544cba47dff1cd to your computer and use it in GitHub Desktop.
Ionic2 - Global Var
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@App({ | |
providers: [GlobalService], // constructed once | |
config: {} | |
}) | |
class MyApp { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from 'angular2/core'; | |
import {Http, Headers} from 'angular2/http'; | |
@Injectable() | |
export class GlobalService { | |
constructor(private http: Http) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Page({ | |
}) | |
export class SpecialsPage { | |
// shared instance being injected | |
constructor(private global: GlobalService) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment