chore(generators): use @Inject for constructor params

Addresses https://github.com/driftyco/ionic/issues/5544.
This commit is contained in:
Tim Lancina
2016-02-22 09:49:10 -06:00
parent c238b750c7
commit fa7d3bcb68
3 changed files with 6 additions and 4 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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 %>;
<% }); %>