Skip to content

Commit fea8ebb

Browse files
add some routing sugar ^^
1 parent f1cd5df commit fea8ebb

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

app/components/bestellung/bestellung.component.js

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/bestellung/bestellung.component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/bestellung/bestellung.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Component, Input, OnInit} from 'angular2/core';
22
import {NgForm} from 'angular2/common';
3+
import {CanActivate} from 'angular2/router';
34

45
import {WarenkorbService} from '../../services/warenkorb.service';
56
import {PizzaService} from '../../services/pizza.service';
@@ -16,13 +17,21 @@ import {Pizza} from '../../interfaces/pizza.interface.ts';
1617
providers: [PizzaService],
1718
templateUrl: './app/components/bestellung/bestellung.component.html'
1819
})
20+
@CanActivate(() => {
21+
// falls false --> BestellungComponente nicht ausgeführt
22+
return true;
23+
})
1924
export class BestellungComponent {
2025
@Input() suche: string;
2126
public pizzen: Pizza[];
2227

2328
constructor(private _warenkorbService: WarenkorbService, private _pizzaService: PizzaService) {
2429
}
2530

31+
routerOnActivate() {
32+
console.log(arguments);
33+
}
34+
2635
ngOnInit() {
2736
this._pizzaService.ladeAngebot().subscribe(pizzen => this.pizzen = pizzen);
2837
}

0 commit comments

Comments
 (0)