blob: 94d711bb700d0991f1607797a0c53485b699c148 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Laptop } from '../models/laptop';
import { LibraryServiceService } from '../services/library.service';
@Component({
selector: 'app-laptop',
templateUrl: './laptop.component.html',
styleUrls: ['./laptop.component.css']
})
export class LaptopComponent implements OnInit {
laptop?:Laptop
laptopoviM?:Laptop[]
constructor(private library: LibraryServiceService, private route:ActivatedRoute, private router:Router) { }
ngOnInit(): void {
this.route.params.subscribe(url =>{
this.library.dajLaptop(url["id"]).subscribe(laptop=>{
this.laptop = laptop;
})
})
}
pogledaj(id:String)
{
this.router.navigate(["/laptop/"+id])
}
}
|