Skip to content

Commit d4e2b28

Browse files
committed
using the new router and ng2-page-scroll (which doesn't work properly yet)
1 parent 0b2c266 commit d4e2b28

7 files changed

Lines changed: 26 additions & 21 deletions

File tree

src/main/webapp/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
4444
"@angular/platform-server": "2.0.0-rc.1",
4545
"@angular/router": "2.0.0-rc.1",
46-
"@angular/router-deprecated": "2.0.0-rc.1",
4746
"core-js": "^2.2.0",
4847
"ng2-page-scroll": "^1.0.0-beta.1",
4948
"rxjs": "5.0.0-beta.6",

src/main/webapp/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
22
import {bootstrap} from '@angular/platform-browser-dynamic';
33
import {provide, enableProdMode} from '@angular/core';
4-
import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
4+
import {ROUTER_PROVIDERS} from '@angular/router';
55

66
import {SimpleJavaMailApp} from './app/simple-java-mail-app';
77

src/main/webapp/src/app/components/download/download.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component} from '@angular/core';
2-
import {ROUTER_DIRECTIVES} from '@angular/router-deprecated';
2+
import {ROUTER_DIRECTIVES} from '@angular/router';
33

44
@Component({
55
directives: [ROUTER_DIRECTIVES],
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import {Component} from '@angular/core';
2-
import {PageScroll} from 'ng2-page-scroll';
2+
import {PageScroll, PageScrollConfig} from 'ng2-page-scroll';
33

44
@Component({
55
template: require('app/components/features/features.html'),
66
directives: [PageScroll]
77
})
88

9-
export class Features { }
9+
export class Features {
10+
constructor() {
11+
// PageScrollConfig.defaultScrollOffset = 200;
12+
// PageScrollConfig.defaultDuration = 50;
13+
// PageScrollConfig._interval = 1000;
14+
}
15+
}

src/main/webapp/src/app/simple-java-mail-app.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1>Simple Java Mail</h1>
33
<h2>Simple API, Complex Emails</h2>
44

5-
<div [hidden]="!router.isRouteActive(router.generate(['/About']))">
5+
<div [hidden]="!router.urlTree.contains(router.createUrlTree(['/about']))">
66
<div class="quick">
77
<pre><code>Email email = new Email.Builder()
88
.from("lollypop", "lolly.pop@pretzelfun.com")
@@ -14,18 +14,18 @@ <h2>Simple API, Complex Emails</h2>
1414

1515
new Mailer().sendMail(email);
1616
</code></pre>
17-
<a [routerLink]=" ['/Download'] " class="index-demo-dl">Download Simple Java Mail</a>
17+
<a [routerLink]=" ['/download'] " class="index-demo-dl">Download Simple Java Mail</a>
1818
</div>
1919
</div>
2020
</div>
2121

2222
<div class="bar-group">
23-
<a class="bar-link" [class.active]="router.isRouteActive(router.generate(['/About']))" [routerLink]=" ['/About'] ">About</a>
24-
<a class="bar-link" [class.active]="router.isRouteActive(router.generate(['/Features']))" [routerLink]=" ['/Features'] ">Features & Examples</a>
25-
<a class="bar-link" [class.active]="router.isRouteActive(router.generate(['/Debugging']))" [routerLink]=" ['/Debugging'] ">Logging & Debugging</a>
26-
<a class="bar-link" [class.active]="router.isRouteActive(router.generate(['/Download']))" [routerLink]=" ['/Download'] ">Download Simple Java
23+
<a class="bar-link" [class.active]="router.urlTree.contains(router.createUrlTree(['/about']))" [routerLink]=" ['/about'] ">About</a>
24+
<a class="bar-link" [class.active]="router.urlTree.contains(router.createUrlTree(['/features']))" [routerLink]=" ['/features'] ">Features & Examples</a>
25+
<a class="bar-link" [class.active]="router.urlTree.contains(router.createUrlTree(['/debugging']))" [routerLink]=" ['/debugging'] ">Logging & Debugging</a>
26+
<a class="bar-link" [class.active]="router.urlTree.contains(router.createUrlTree(['/download']))" [routerLink]=" ['/download'] ">Download Simple Java
2727
Mail</a>
28-
<a class="bar-link" [class.active]="router.isRouteActive(router.generate(['/Contact']))" [routerLink]=" ['/Contact'] ">Contact</a>
28+
<a class="bar-link" [class.active]="router.urlTree.contains(router.createUrlTree(['/contact']))" [routerLink]=" ['/contact'] ">Contact</a>
2929
</div>
3030

3131
<main>

src/main/webapp/src/app/simple-java-mail-app.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
declare var Prism:any;
22

33
import {Component, ViewEncapsulation, AfterViewChecked} from '@angular/core';
4-
import {Router, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
4+
import {Router, Routes, ROUTER_DIRECTIVES} from '@angular/router';
55

66
import {About} from './components/about/about';
77
import {Features} from './components/features/features';
@@ -17,13 +17,13 @@ import {Contact} from './components/contact/contact';
1717
encapsulation: ViewEncapsulation.None
1818
})
1919

20-
@RouteConfig([
21-
{path: '/about', component: About, name: 'About', useAsDefault: true},
22-
{path: '/features', component: Features, name: 'Features'},
23-
{path: '/debugging', component: Debugging, name: 'Debugging'},
24-
{path: '/download', component: Download, name: 'Download'},
25-
{path: '/contact', component: Contact, name: 'Contact'}/*,
26-
{path: '/**', redirectTo: ['About']}*/
20+
@Routes([
21+
{path: '/about', component: About},
22+
{path: '/features', component: Features},
23+
{path: '/debugging', component: Debugging},
24+
{path: '/download', component: Download},
25+
{path: '/contact', component: Contact},
26+
{path: '', component: About}
2727
])
2828

2929
export class SimpleJavaMailApp implements AfterViewChecked {

src/main/webapp/src/vendor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import '@angular/platform-browser-dynamic';
55
import '@angular/platform-browser';
66
import '@angular/core';
77
import '@angular/http';
8-
import '@angular/router-deprecated';
8+
import '@angular/router';
99

1010

1111
// RxJS 5

0 commit comments

Comments
 (0)