blob: 5211c4d3435e03c3cc6a9261345ef4e18bd5c442 (
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
31
32
33
34
35
|
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { LaptopComponent } from '../laptop/laptop.component';
import { Laptop } from '../models/laptop';
import { LibraryServiceService } from '../services/library.service';
@Component({
selector: 'app-new-laptop',
templateUrl: './new-laptop.component.html',
styleUrls: ['./new-laptop.component.css']
})
export class NewLaptopComponent implements OnInit {
laptop:Laptop= {} as Laptop
constructor(private router:Router, private library: LibraryServiceService) { }
ngOnInit(): void {
}
back()
{
this.router.navigate(["/homepage"])
}
dodaj(laptop:Laptop)
{
this.library.unesiLaptop(laptop).subscribe(laptop=>{
this.router.navigate(["/laptop/"+laptop.id])
})
}
}
|