Skip to content

Commit 755d542

Browse files
authored
Merge branch 'canary' into canary-version
2 parents 5aa4adf + 973ca50 commit 755d542

27 files changed

+235
-202
lines changed

Diff for: src/generators/app/index.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ export class Generator extends Base {
175175
choices: ['CSS', 'Sass', 'Stylus', 'Less'],
176176
filter: val => val.toLowerCase()
177177
}, {
178-
type: 'list',
179-
name: 'router',
180-
default: 1,
181-
message: 'What Angular router would you like to use?',
182-
choices: ['ngRoute', 'uiRouter'],
183-
filter: val => val.toLowerCase()
184-
}, {
178+
// type: 'list',
179+
// name: 'router',
180+
// default: 1,
181+
// message: 'What Angular router would you like to use?',
182+
// choices: ['ngRoute', 'uiRouter'],
183+
// filter: val => val.toLowerCase()
184+
//}, {
185185
type: 'confirm',
186186
name: 'bootstrap',
187187
message: 'Would you like to include Bootstrap?'
@@ -204,8 +204,9 @@ export class Generator extends Base {
204204
this.filters[answers.stylesheet] = true;
205205
insight.track('stylesheet', answers.stylesheet);
206206

207-
this.filters[answers.router] = true;
208-
insight.track('router', answers.router);
207+
//this.filters[answers.router] = true;
208+
//insight.track('router', answers.router);
209+
this.filters['ngroute'] = true;
209210

210211
this.filters.bootstrap = !!answers.bootstrap;
211212
insight.track('bootstrap', !!answers.bootstrap);

Diff for: src/test/fixtures/.yo-rc.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"flow": false,
1919
"html": true,
2020
"sass": true,
21-
"uirouter": true,
21+
"ngroute": true,
2222
"bootstrap": true,
2323
"uibootstrap": true,
2424
"ws": true,
@@ -41,11 +41,10 @@
4141
"moduleName": "",
4242
"modulePrompt": true,
4343
"filters": [
44-
"uirouter",
44+
"ngroute",
4545
"mocha",
4646
"expect",
4747
"should",
48-
"uirouter",
4948
"es6",
5049
"webpack"
5150
],

Diff for: src/test/main.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const defaultOptions = {
1919
transpiler: 'babel',
2020
markup: 'html',
2121
stylesheet: 'sass',
22-
router: 'uirouter',
22+
router: 'ngroute',
2323
testing: 'mocha',
2424
chai: 'expect',
2525
bootstrap: true,
@@ -193,7 +193,7 @@ describe('angular-fullstack:app', function() {
193193
transpiler: 'ts',
194194
markup: 'pug',
195195
stylesheet: 'less',
196-
router: 'uirouter',
196+
router: 'ngroute',
197197
testing: 'jasmine',
198198
odms: ['mongoose'],
199199
auth: true,
@@ -265,7 +265,7 @@ describe('angular-fullstack:app', function() {
265265
transpiler: 'babel',
266266
markup: 'pug',
267267
stylesheet: 'css',
268-
router: 'uirouter',
268+
router: 'ngroute',
269269
testing: 'jasmine',
270270
odms: ['sequelize'],
271271
auth: true,
@@ -337,7 +337,7 @@ describe('angular-fullstack:app', function() {
337337
transpiler: 'ts',
338338
markup: 'pug',
339339
stylesheet: 'stylus',
340-
router: 'uirouter',
340+
router: 'ngroute',
341341
testing: 'mocha',
342342
chai: 'should',
343343
odms: [],

Diff for: templates/app/_package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@
5454
"@angularclass/match-control": "^2.0.0",
5555
"reflect-metadata": "^0.1.3",
5656
"rxjs": "^5.3.0",
57-
"zone.js": "^0.7.2",
58-
"@angular/common": "~2.4.9",
59-
"@angular/compiler": "~2.4.9",
60-
"@angular/core": "~2.4.9",
61-
"@angular/forms": "~2.4.9",
62-
"@angular/http": "~2.4.9",
57+
"zone.js": "^0.8.4",
58+
"@angular/common": "^4.3.3",
59+
"@angular/compiler": "^4.3.3",
60+
"@angular/core": "^4.3.3",
61+
"@angular/forms": "^4.3.3",
62+
"@angular/http": "^4.3.3",
63+
"@angular/platform-browser": "^4.3.3",
64+
"@angular/platform-browser-dynamic": "^4.3.3",
65+
"@angular/router": "^4.3.3",
6366
<%#"@angular/material": "^2.0.0-alpha.10",%>
64-
"@angular/platform-browser": "~2.4.9",
65-
"@angular/platform-browser-dynamic": "~2.4.9",
66-
"@angular/router": "^3.4.7",
6767
"@angularclass/hmr": "^1.2.1",
6868
<%_ if(filters.ts) { -%>
6969
"@types/core-js": "^0.9.41",
@@ -82,7 +82,7 @@
8282
"@types/webpack": "^2.2.15",
8383
<%_ } -%>
8484
"angular2-universal": "2.1.0-rc.1",
85-
"angular2-jwt": "^0.1.24",
85+
"angular2-jwt": "^0.1.28",
8686
<% if(filters.auth) { %>
8787
"angular-validation-match": "^1.9.0",<% } %>
8888
<% if(filters.uirouter) { %>

Diff for: templates/app/client/__index.html

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4+
<base href="/">
45
<meta charset="utf-8">
56
<meta http-equiv="x-ua-compatible" content="ie=edge">
6-
<base href="/">
77
<title>Angular Full-Stack Generator</title>
88
<meta name="description" content="">
99
<meta name="viewport" content="width=device-width">
@@ -25,9 +25,6 @@
2525
ga('send', 'pageview');
2626
</script>
2727

28-
<app>LOADING</app>
29-
<navbar></navbar>
30-
<% if (filters.ngroute) { %><div ng-view=""></div><% } %><% if (filters.uirouter) { %><div ui-view=""></div><% } %>
31-
<footer></footer>
28+
<app>Loading...</app>
3229
</body>
3330
</html>

Diff for: templates/app/client/app/account(auth)/account.module.js

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
import { NgModule } from '@angular/core';
22
import { FormsModule } from '@angular/forms';
33
import { BrowserModule } from '@angular/platform-browser';
4-
<%_ if (filters.uirouter) { -%>
4+
<%_ if(filters.uirouter) { -%>
55
import { UIRouterModule } from 'ui-router-ng2';<% } %>
6-
<%_ if (filters.ngroute) { -%><% } %>
6+
<%_ if(filters.ngroute) { -%>
7+
import { RouterModule, Routes } from '@angular/router';<% } %>
78
<%_ if(filters.oauth) { -%>
89
import { DirectivesModule } from '../../components/directives.module';<% } %>
910

10-
import { STATES } from './account.routes';
11+
<%_ if(filters.uirouter) { -%>
12+
import { STATES } from './account.routes';<% } %>
1113

1214
import { LoginComponent } from './login/login.component';
13-
import { SignupComponent } from './signup/signup.component';
1415
import { SettingsComponent } from './settings/settings.component';
16+
import { SignupComponent } from './signup/signup.component';
17+
18+
<%_ if(filters.ngroute) { -%>
19+
const accountRoutes: Routes = [{
20+
path: 'login',
21+
component: LoginComponent,
22+
//data: { title: 'Home' }
23+
}, {
24+
path: 'settings',
25+
component: SettingsComponent,
26+
}, {
27+
path: 'signup',
28+
component: SignupComponent,
29+
}];<% } %>
1530

1631
@NgModule({
1732
imports: [
1833
FormsModule,
1934
BrowserModule,
20-
<%_ if (filters.uirouter) { -%>
35+
<%_ if(filters.uirouter) { -%>
2136
UIRouterModule.forChild({
2237
states: STATES,
2338
}),<% } %>
24-
<%_ if (filters.ngroute) { -%><% } %>
39+
<%_ if(filters.ngroute) { -%>
40+
RouterModule.forChild(accountRoutes),<% } %>
2541
<%_ if(filters.oauth) { -%>
2642
DirectivesModule,<% } %>
2743
],

Diff for: templates/app/client/app/account(auth)/login/login.component.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Component } from '@angular/core';
22
<%_ if(filters.uirouter) { -%>
33
import { StateService } from 'ui-router-ng2';<% } %>
4-
<%_ if(filters.ngroute) { -%><% } %>
4+
<%_ if(filters.ngroute) { -%>
5+
import { Router } from '@angular/router';<% } %>
56
import { AuthService } from '../../../components/auth/auth.service';
67

78
// @flow
@@ -33,14 +34,16 @@ export class LoginComponent {
3334
errors = {login: undefined};
3435
submitted = false;
3536
AuthService;
36-
<%_ if(filters.ngroute) { -%><% } %>
37+
<%_ if(filters.ngroute) { -%>
38+
Router;<% } %>
3739
<%_ if(filters.uirouter) { -%>
3840
StateService;<% } %>
3941

40-
static parameters = [AuthService, <% if(filters.ngroute) { %><% } else { %>StateService<% } %>];
41-
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %><% } else { %>_StateService_: StateService<% } %>) {
42+
static parameters = [AuthService, <% if(filters.ngroute) { %>Router<% } else { %>StateService<% } %>];
43+
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %>router: Router<% } else { %>_StateService_: StateService<% } %>) {
4244
this.AuthService = _AuthService_;
43-
<%_ if(filters.ngroute) { -%><% } %>
45+
<%_ if(filters.ngroute) { -%>
46+
this.Router = router;<% } %>
4447
<%_ if(filters.uirouter) { -%>
4548
this.StateService = _StateService_;<% } %>
4649
}
@@ -54,7 +57,10 @@ export class LoginComponent {
5457
})
5558
.then(() => {
5659
// Logged in, redirect to home
57-
this.StateService.go('main');
60+
<%_ if(filters.ngroute) { -%>
61+
this.Router.navigateByUrl('/home');<% } %>
62+
<%_ if(filters.uirouter) { -%>
63+
this.StateService.go('main');<% } %>
5864
})
5965
.catch(err => {
6066
this.errors.login = err.message;

Diff for: templates/app/client/app/account(auth)/settings/settings.component.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ export class SettingsComponent {
4040
changePassword(form) {
4141
this.submitted = true;
4242

43-
if(form.$valid) {
44-
this.AuthService.changePassword(this.user.oldPassword, this.user.newPassword)
45-
.then(() => {
46-
this.message = 'Password successfully changed.';
47-
})
48-
.catch(() => {
49-
form.password.$setValidity('mongoose', false);
50-
this.errors.other = 'Incorrect password';
51-
this.message = '';
52-
});
53-
}
43+
return this.AuthService.changePassword(this.user.oldPassword, this.user.newPassword)
44+
.then(() => {
45+
this.message = 'Password successfully changed.';
46+
})
47+
.catch(() => {
48+
// form.password.$setValidity('mongoose', false);
49+
this.errors.other = 'Incorrect password';
50+
this.message = '';
51+
});
5452
}
5553
}

Diff for: templates/app/client/app/account(auth)/settings/settings.html

+9-11
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,31 @@ <h1>Change Password</h1>
99
<div class="form-group">
1010
<label>Current Password</label>
1111

12-
<input type="password" name="password" class="form-control" [(ngModel)]="user.oldPassword" mongoose-error/>
13-
<p class="help-block" [hidden]="!form.password.$error.mongoose">
14-
{{ errors.other }}
12+
<input type="password" name="password" class="form-control" [(ngModel)]="user.oldPassword" required #oldPassword="ngModel"/>
13+
<p class="help-block" [hidden]="oldPassword.valid || !submitted">
14+
Required
1515
</p>
1616
</div>
1717

1818
<div class="form-group">
1919
<label>New Password</label>
2020

21-
<input type="password" name="newPassword" class="form-control" [(ngModel)]="user.newPassword"
22-
ng-minlength="3"
23-
required/>
21+
<input type="password" name="newPassword" class="form-control" [(ngModel)]="user.newPassword" required #newPassword="ngModel"
22+
minlength="3"/>
2423
<p class="help-block"
25-
[hidden]="!(form.newPassword.$error.minlength || form.newPassword.$error.required) || !(form.newPassword.$dirty || submitted)">
24+
[hidden]="newPassword.valid || !submitted">
2625
Password must be at least 3 characters.
2726
</p>
2827
</div>
2928

3029
<div class="form-group">
3130
<label>Confirm New Password</label>
3231

33-
<input type="password" name="confirmPassword" class="form-control" [(ngModel)]="user.confirmPassword"
32+
<input type="password" name="confirmPassword" class="form-control" [(ngModel)]="user.confirmPassword" required #confirmPassword="ngModel"
3433
match="user.newPassword"
35-
ng-minlength="3"
36-
required=""/>
34+
minlength="3"/>
3735
<p class="help-block"
38-
[hidden]="!form.confirmPassword.$error.match || !submitted">
36+
[hidden]="confirmPassword.valid || !submitted">
3937
Passwords must match.
4038
</p>
4139

Diff for: templates/app/client/app/account(auth)/signup/signup.component.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import { Component } from '@angular/core';
33
<%_ if(filters.uirouter) { -%>
44
import { StateService } from 'ui-router-ng2';<% } %>
5-
<%_ if(filters.ngroute) { -%><% } %>
5+
<%_ if(filters.ngroute) { -%>
6+
import { Router } from '@angular/router';<% } %>
67
import { AuthService } from '../../../components/auth/auth.service';
7-
import {ANGULARCLASS_MATCH_CONTROL_DIRECTIVES} from '@angularclass/match-control';
88

99
<%_ if(filters.flow) { -%>
1010
type User = {
@@ -21,8 +21,7 @@ interface User {
2121

2222
@Component({
2323
selector: 'signup',
24-
template: require('./signup.<%=templateExt%>'),
25-
directives: [...ANGULARCLASS_MATCH_CONTROL_DIRECTIVES]
24+
template: require('./signup.<%=templateExt%>')
2625
})
2726
export class SignupComponent {
2827
user: User = {
@@ -33,14 +32,16 @@ export class SignupComponent {
3332
errors = {};
3433
submitted = false;
3534
AuthService;
36-
<%_ if(filters.ngroute) { -%><% } %>
35+
<%_ if(filters.ngroute) { -%>
36+
Router;<% } %>
3737
<%_ if(filters.uirouter) { -%>
3838
StateService;<% } %>
3939

40-
static parameters = [AuthService, <% if(filters.ngroute) { %><% } else { %>StateService<% } %>];
41-
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %><% } else { %>_StateService_: StateService<% } %>) {
40+
static parameters = [AuthService, <% if(filters.ngroute) { %>Router<% } else { %>StateService<% } %>];
41+
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %>router: Router<% } else { %>_StateService_: StateService<% } %>) {
4242
this.AuthService = _AuthService_;
43-
<%_ if(filters.ngroute) { -%><% } -%>
43+
<%_ if(filters.ngroute) { -%>
44+
this.Router = router;<% } -%>
4445
<%_ if(filters.uirouter) { -%>
4546
this.StateService = _StateService_;<% } -%>
4647
}
@@ -55,7 +56,7 @@ export class SignupComponent {
5556
})
5657
.then(() => {
5758
// Account created, redirect to home
58-
<% if(filters.ngroute) { %>this.$location.path('/');<% } -%>
59+
<% if(filters.ngroute) { %>this.Router.navigateByUrl('/home');<% } -%>
5960
<% if(filters.uirouter) { %>this.StateService.go('main');<% } -%>
6061
})
6162
.catch(err => {

Diff for: templates/app/client/app/admin(auth)/admin.component.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class AdminComponent {
1212

1313
<%_ } _%>
1414
static parameters = [UserService];
15-
constructor(userService: UserService) {
15+
constructor(<%= private() %>userService: UserService) {
1616
this.userService = userService;
1717
// Use the user service to fetch all users
1818
this.userService.query().subscribe(users => {

Diff for: templates/app/client/app/admin(auth)/admin.module.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ import { RouterModule, Routes } from '@angular/router';<% } %>
77

88
import { AdminComponent } from './admin.component';
99

10-
<%_ if(filters.ngroute) { -%>
11-
import { ROUTES } from './admin.routes';<% } %>
1210
<%_ if(filters.uirouter) { -%>
1311
import { STATES } from './admin.routes';<% } %>
12+
<%_ if(filters.ngroute) { -%>
13+
const adminRoutes: Routes = [{
14+
path: 'admin',
15+
component: AdminComponent,
16+
}];<% } %>
1417

1518
@NgModule({
1619
imports: [
1720
BrowserModule,
1821
<%_ if(filters.ngroute) { _%>
19-
RouterModule.forChild(ROUTES),<% } %>
22+
RouterModule.forChild(adminRoutes),<% } %>
2023
<%_ if(filters.uirouter) { _%>
2124
UIRouterModule.forChild({
2225
states: STATES,

0 commit comments

Comments
 (0)