Skip to content
This repository was archived by the owner on Jun 25, 2019. It is now read-only.

Commit 4358252

Browse files
author
Felix Gladisch
committed
refactor: HTML5-Routing, styleUrls
1 parent 3aaf55b commit 4358252

File tree

10 files changed

+21
-12
lines changed

10 files changed

+21
-12
lines changed

src/app/about/about.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Nothing here...

src/app/about/about.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
33
@Component({
44
selector: 'seed-about',
55
templateUrl: './about.component.html',
6-
styles: [require('./about.component.scss')]
6+
styleUrls: ['./about.component.scss']
77
})
88
export class AboutComponent { }

src/app/app.component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.jumbotron {
2+
h1 {
3+
font-weight: 700;
4+
}
5+
}

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { TranslateService } from 'ng2-translate/ng2-translate';
55
selector: 'app',
66
encapsulation: ViewEncapsulation.None,
77
templateUrl: './app.component.html',
8-
styles: [require('./app.component.scss')]
8+
styleUrls: ['./app.component.scss']
99
})
1010
export class AppComponent {
1111

src/app/app.module.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TranslateModule } from 'ng2-translate/ng2-translate';
77
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
88

99
import { AppComponent } from './app.component';
10-
import { AppRoutes } from './app.routes';
10+
import { routing } from './app.routing';
1111
import { HomeComponent } from './home';
1212
import { AboutComponent } from './about';
1313
import { NavigationComponent } from './navigation';
@@ -21,14 +21,11 @@ import { NavigationComponent } from './navigation';
2121
AboutComponent
2222
],
2323
imports: [
24+
routing,
2425
HttpModule,
2526
FormsModule,
2627
BrowserModule,
27-
TranslateModule.forRoot(),
28-
RouterModule.forRoot(AppRoutes)
29-
],
30-
providers: [
31-
{ provide: LocationStrategy, useClass: HashLocationStrategy }
28+
TranslateModule.forRoot()
3229
]
3330
})
3431
export class AppModule { }
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Routes } from '@angular/router';
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
23

34
import { HomeComponent } from './home';
45
import { AboutComponent } from './about';
56

6-
export const AppRoutes: Routes = [
7+
export const appRoutes: Routes = [
78
// #/ -> #/home
89
{ path: '', redirectTo: 'home', pathMatch: 'full' },
910
// #/home
@@ -13,3 +14,5 @@ export const AppRoutes: Routes = [
1314
// #/xyz -> #/home
1415
{ path: '**', redirectTo: 'home' }
1516
];
17+
18+
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);

src/app/home/home.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Nothing here...

src/app/home/home.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { Component } from '@angular/core';
33
@Component({
44
selector: 'seed-home',
55
templateUrl: './home.component.html',
6-
styles: [require('./home.component.scss')]
6+
styleUrls: ['./home.component.scss']
77
})
88
export class HomeComponent { }

src/app/navigation/navigation.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TranslateService } from 'ng2-translate/ng2-translate';
44
@Component({
55
selector: 'seed-navigation',
66
templateUrl: './navigation.component.html',
7-
styles: [require('./navigation.component.scss')]
7+
styleUrls: ['./navigation.component.scss']
88
})
99
export class NavigationComponent {
1010

src/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<meta http-equiv="X-UA-Compatible" content="IE=edge">
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99

10+
<base href="/">
11+
1012
<title>Angular App</title>
1113

1214
</head>

0 commit comments

Comments
 (0)