import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; @Component({ template: `
Hier könnte auch der Datensatz mit der Id {{id}} stehen!
` }) export class FlightEditComponent implements OnInit { public id: string; constructor(private route: ActivatedRoute) { route.params.subscribe(p => { this.id = p['id']; }); } ngOnInit() {} exitWarning = { show: false, resolve: null }; decide(decision: boolean) { this.exitWarning.show = false; this.exitWarning.resolve(decision); } canDeactivate() { this.exitWarning.show = true; return new Promise(resolve => { this.exitWarning.resolve = resolve; }); } }