Skip to content

Commit 0b6ada3

Browse files
committed
stash
1 parent 01b9a11 commit 0b6ada3

File tree

6 files changed

+41
-13
lines changed

6 files changed

+41
-13
lines changed

templates/app/client/__index.html

Lines changed: 2 additions & 2 deletions
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">
@@ -27,7 +27,7 @@
2727

2828
<app>LOADING</app>
2929
<navbar></navbar>
30-
<% if (filters.ngroute) { %><div ng-view=""></div><% } %><% if (filters.uirouter) { %><div ui-view=""></div><% } %>
30+
<% if (filters.ngroute) { %><router-outlet></router-outlet><% } %><% if (filters.uirouter) { %><div ui-view=""></div><% } %>
3131
<footer></footer>
3232
</body>
3333
</html>

templates/app/client/app/app.component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
33
@Component({
44
selector: 'app',
55
template: `<navbar></navbar>
6-
<ui-view></ui-view>
6+
<% if (filters.ngroute) { %><router-outlet></router-outlet><% } %><% if (filters.uirouter) { %><ui-view></ui-view><% } %>
77
<footer></footer>`
88
})
99
export class AppComponent {}

templates/app/client/app/app.module.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,16 @@ import {
6666
} from '@angularclass/hmr';
6767
<%_ if (filters.uirouter) { -%>
6868
import { UIRouterModule } from 'ui-router-ng2';<% } %>
69+
<%_ if (filters.ngroute) { -%>
70+
import { RouterModule, Routes } from '@angular/router';<% } %>
6971
import { provideAuth } from 'angular2-jwt';
7072

7173
import { AppComponent } from './app.component';
7274
import { MainModule } from './main/main.module';
75+
import { MainComponent } from './main/main.component';
7376
import { DirectivesModule } from '../components/directives.module';
74-
import { AccountModule } from './account/account.module';
75-
import { AdminModule } from './admin/admin.module';
77+
//import { AccountModule } from './account/account.module';
78+
//import { AdminModule } from './admin/admin.module';
7679

7780
import constants from './app.constants';
7881

@@ -95,16 +98,34 @@ if(constants.env === 'development') {
9598
providers.push({ provide: RequestOptions, useClass: HttpOptions });
9699
}
97100

101+
const appRoutes: Routes = [
102+
//{ path: 'crisis-center', component: CrisisListComponent },
103+
//{ path: 'hero/:id', component: HeroDetailComponent },
104+
{
105+
path: 'home',
106+
component: MainComponent,
107+
data: { title: 'Home' }
108+
},
109+
{ path: '',
110+
redirectTo: '/home',
111+
pathMatch: 'full'
112+
},
113+
//{ path: '**', component: PageNotFoundComponent }
114+
];
115+
98116
@NgModule({
99117
providers,
100118
imports: [
101119
BrowserModule,
102120
HttpModule,
103-
UIRouterModule.forRoot(),
121+
<%_ if (filters.uirouter) { -%>
122+
UIRouterModule.forRoot(),<% } %>
123+
<%_ if (filters.ngroute) { -%>
124+
RouterModule.forRoot(appRoutes, { enableTracing: true }),<% } %>
104125
MainModule,
105126
DirectivesModule,
106-
AccountModule,
107-
AdminModule,
127+
//AccountModule,
128+
//AdminModule,
108129
],
109130
declarations: [
110131
AppComponent,

templates/app/client/components/directives.module.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
3-
import { UIRouterModule } from 'ui-router-ng2';
3+
<%_ if (filters.uirouter) { -%>
4+
import { UIRouterModule } from 'ui-router-ng2';<% } %>
5+
<%_ if (filters.ngroute) { -%>
6+
import { RouterModule, Routes } from '@angular/router';<% } %>
47
import { CollapseModule } from 'ng2-bootstrap';
58

69
import { AuthModule } from './auth/auth.module';
@@ -13,7 +16,10 @@ import { OauthButtonsComponent } from './oauth-buttons/oauth-buttons.component';
1316
@NgModule({
1417
imports: [
1518
CommonModule,
16-
UIRouterModule.forChild(),
19+
<%_ if (filters.uirouter) { -%>
20+
UIRouterModule.forChild(),<% } %>
21+
<%_ if (filters.ngroute) { -%>
22+
RouterModule.forChild(),<% } %>
1723
CollapseModule,
1824
AuthModule,
1925
],

templates/app/client/components/navbar/navbar.component.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component } from '@angular/core';
22
<%_ if (filters.auth) { -%>
3-
<%_ if (filters.uirouter) { -%>
3+
<%_ if (filters.uirouter) { -%>
44
import { StateService } from 'ui-router-ng2';<% } %>
55
import { AuthService } from '../auth/auth.service';<% } %>
66

@@ -22,7 +22,8 @@ export class NavbarComponent {
2222
static parameters = [AuthService<% if(filters.uirouter) { %>, StateService<% } %>];
2323
constructor(authService: AuthService<% if(filters.uirouter) { %>, stateService: StateService<% } %>) {
2424
this.AuthService = authService;
25-
this.StateService = stateService;
25+
<%_ if (filters.uirouter) { -%>
26+
this.StateService = stateService;<% } %>
2627

2728
this.reset();
2829

templates/app/client/components/navbar/navbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div [collapse]="isCollapsed" class="navbar-collapse collapse" id="navbar-main">
1313
<ul class="nav navbar-nav">
1414
<li *ngFor="let item of menu" <% if(filters.uirouter) { %>uiSrefActive="active"<% } else { %>ng-class="{active: isActive(item.link)}"<% } %>>
15-
<a <% if(filters.uirouter) { %>uiSref="{{item.state}}"<% } else { %>ng-href="{{item.link}}"<% } %>>{{item.title}}</a>
15+
<a <% if(filters.uirouter) { %>uiSref="{{item.state}}"<% } else { %>href="{{item.link}}"<% } %>>{{item.title}}</a>
1616
</li>
1717
<%_ if(filters.auth) { -%>
1818
<li [hidden]="!isAdmin" <% if(filters.uirouter) { %>uiSrefActive="active"<% } else { %>ng-class="{active: isActive('/admin')}"<% } %>>

0 commit comments

Comments
 (0)