mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(generators): use @Inject for constructor params
Addresses https://github.com/driftyco/ionic/issues/5544.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {Page, NavController} from 'ionic/ionic';
|
||||
import {Inject} from 'angular2/core';
|
||||
|
||||
/*
|
||||
Generated class for the <%= jsClassName %> page.
|
||||
@@ -10,7 +11,7 @@ import {Page, NavController} from 'ionic/ionic';
|
||||
templateUrl: 'build/<%= directory %>/<%= fileName %>/<%= fileName %>.html',
|
||||
})
|
||||
export class <%= jsClassName %> {
|
||||
constructor(nav: NavController) {
|
||||
constructor(@Inject(NavController) nav) {
|
||||
this.nav = nav;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from 'angular2/core';
|
||||
import {Injectable, Inject} from 'angular2/core';
|
||||
import {Http} from 'angular2/http';
|
||||
|
||||
/*
|
||||
@@ -9,7 +9,7 @@ import {Http} from 'angular2/http';
|
||||
*/
|
||||
@Injectable()
|
||||
export class <%= jsClassName %> {
|
||||
constructor(http: Http) {
|
||||
constructor(@Inject(Http) http) {
|
||||
this.http = http;
|
||||
this.data = null;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {NavController, Page} from 'ionic/ionic';
|
||||
import {Inject} from 'angular2/core';
|
||||
<% _.forEach(tabs, function(tab) { %>import {<%= tab.jsClassName %>} from '../<%= tab.fileName %>/<%= tab.fileName %>';
|
||||
<% }); %>
|
||||
|
||||
@@ -6,7 +7,7 @@ import {NavController, Page} from 'ionic/ionic';
|
||||
templateUrl: 'build/<%= directory %>/<%= fileName %>/<%= fileName %>.html'
|
||||
})
|
||||
export class <%= jsClassName %> {
|
||||
constructor(nav: NavController) {
|
||||
constructor(@Inject(NavController) nav) {
|
||||
// set the root pages for each tab
|
||||
<% _.forEach(tabs, function(tab, i) { %>this.tab<%= ++i %>Root = <%= tab.jsClassName %>;
|
||||
<% }); %>
|
||||
|
||||
Reference in New Issue
Block a user