duck-booking-tool-front/app/duck-detail.component.ts
Gergely Polonkai 3e02eb4abb Update for the final version of Angular2
It lost some functionality, but it was never put to use.
2016-10-28 05:19:23 +02:00

30 lines
767 B
TypeScript

import { Component, OnInit} from "@angular/core";
import { ActivatedRoute, Params } from "@angular/router";
import { Location } from "@angular/common";
import { Duck } from "./models";
import { DuckService } from "./duck.service";
@Component({
moduleId: module.id,
selector: "duck-detail",
templateUrl: "duck-detail.component.html"
})
export class DuckDetailComponent {
duck: Duck;
constructor(
private duckService: DuckService,
private route: ActivatedRoute,
private location: Location)
{}
ngOnInit(): void {
this.route.params.forEach((params: Params) => {
let id = +params['id'];
this.duckService.getDuck(id)
.then(duck => this.duck = duck);
})
}
}