Skip to content

Commit

Permalink
fix(decorators): changes to match angular style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
jgw96 committed Jun 10, 2016
1 parent 761a1f6 commit 9315c68
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion tooling/generators/component/component.tmpl.js
@@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import { Component } from '@angular/core';

/*
Generated class for the <%= jsClassName %> component.
Expand Down
5 changes: 4 additions & 1 deletion tooling/generators/component/component.tmpl.ts
@@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import { Component } from '@angular/core';

/*
Generated class for the <%= jsClassName %> component.
Expand All @@ -11,6 +11,9 @@ import {Component} from '@angular/core';
templateUrl: 'build/<%= directory %>/<%= fileName %>/<%= fileName %>.html'
})
export class <%= jsClassName %> {

text: string;

constructor() {
this.text = 'Hello World';
}
Expand Down
2 changes: 1 addition & 1 deletion tooling/generators/directive/directive.tmpl.js
@@ -1,4 +1,4 @@
import {Directive} from '@angular/core';
import { Directive } from '@angular/core';

/*
Generated class for the <%= jsClassName %> directive.
Expand Down
2 changes: 1 addition & 1 deletion tooling/generators/directive/directive.tmpl.ts
@@ -1,4 +1,4 @@
import {Directive} from '@angular/core';
import { Directive } from '@angular/core';

/*
Generated class for the <%= jsClassName %> directive.
Expand Down
4 changes: 2 additions & 2 deletions tooling/generators/page/page.tmpl.js
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

/*
Generated class for the <%= jsClassName %> page.
Expand Down
6 changes: 3 additions & 3 deletions tooling/generators/page/page.tmpl.ts
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

/*
Generated class for the <%= jsClassName %> page.
Expand All @@ -11,5 +11,5 @@ import {NavController} from 'ionic-angular';
templateUrl: 'build/<%= directory %>/<%= fileName %>/<%= fileName %>.html',
})
export class <%= jsClassName %> {
constructor(public nav: NavController) {}
constructor(private nav: NavController) {}
}
2 changes: 1 addition & 1 deletion tooling/generators/pipe/pipe.tmpl.js
@@ -1,4 +1,4 @@
import {Injectable, Pipe} from '@angular/core';
import { Injectable, Pipe } from '@angular/core';

/*
Generated class for the <%= jsClassName %> pipe.
Expand Down
2 changes: 1 addition & 1 deletion tooling/generators/pipe/pipe.tmpl.ts
@@ -1,4 +1,4 @@
import {Injectable, Pipe} from '@angular/core';
import { Injectable, Pipe } from '@angular/core';

/*
Generated class for the <%= jsClassName %> pipe.
Expand Down
4 changes: 2 additions & 2 deletions tooling/generators/provider/provider.tmpl.js
@@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';

/*
Expand Down
10 changes: 6 additions & 4 deletions tooling/generators/provider/provider.tmpl.ts
@@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';

/*
Expand All @@ -10,9 +10,11 @@ import 'rxjs/add/operator/map';
*/
@Injectable()
export class <%= jsClassName %> {
data: any = null;
data: any;

constructor(public http: Http) {}
constructor(private http: Http) {
this.data = null;

This comment has been minimized.

Copy link
@manucorporat

manucorporat Jun 10, 2016

Contributor

@jgw96 why this change?

This comment has been minimized.

Copy link
@jgw96

jgw96 Jun 10, 2016

Author Contributor

More in line with the angular style guide and the angular-cli generated code

This comment has been minimized.

Copy link
@adamdbradley

adamdbradley Jun 10, 2016

Contributor

Where is there an example of this?

This comment has been minimized.

Copy link
@jgw96

jgw96 Jun 10, 2016

Author Contributor

Well, now i can find examples of both ways after looking through the angular site. Which way do you guys prefer?

}

load() {
if (this.data) {
Expand Down
6 changes: 3 additions & 3 deletions tooling/generators/tabs/tabs.tmpl.js
@@ -1,6 +1,6 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
<% _.forEach(tabs, function(tab) { %>import {<%= tab.jsClassName %>} from '../<%= tab.fileName %>/<%= tab.fileName %>';
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
<% _.forEach(tabs, function(tab) { %>import { <%= tab.jsClassName %> } from '../<%= tab.fileName %>/<%= tab.fileName %>';
<% }); %>

@Component({
Expand Down
8 changes: 4 additions & 4 deletions tooling/generators/tabs/tabs.tmpl.ts
@@ -1,14 +1,14 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
<% _.forEach(tabs, function(tab) { %>import {<%= tab.jsClassName %>} from '../<%= tab.fileName %>/<%= tab.fileName %>';
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
<% _.forEach(tabs, function(tab) { %>import { <%= tab.jsClassName %> } from '../<%= tab.fileName %>/<%= tab.fileName %>';
<% }); %>

@Component({
templateUrl: 'build/<%= directory %>/<%= fileName %>/<%= fileName %>.html'
})
export class <%= jsClassName %> {

constructor(public nav: NavController) {
constructor(private nav: NavController) {
// set the root pages for each tab
<% _.forEach(tabs, function(tab, i) { %>this.tab<%= ++i %>Root = <%= tab.jsClassName %>;
<% }); %>
Expand Down

2 comments on commit 9315c68

@jgw96
Copy link
Contributor Author

@jgw96 jgw96 commented on 9315c68 Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

references issue #6847

@jgw96
Copy link
Contributor Author

@jgw96 jgw96 commented on 9315c68 Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the commit message on this one. Should be fix(generators) not decorators.

Please sign in to comment.