From dce4e644d5e5d9c97ff5ac337448b52f2a2a64fd Mon Sep 17 00:00:00 2001 From: TAMARA JERINIC Date: Wed, 2 Mar 2022 23:38:27 +0100 Subject: Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into Tamara # Conflicts: # .gitignore --- .../src/app/homepage/homepage.component.ts | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts (limited to 'sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts') diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts new file mode 100755 index 00000000..4ebea54d --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/homepage/homepage.component.ts @@ -0,0 +1,42 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { Laptop } from '../models/laptop'; +import { LibraryServiceService } from '../services/library.service'; + +@Component({ + selector: 'app-homepage', + templateUrl: './homepage.component.html', + styleUrls: ['./homepage.component.css'] +}) +export class HomepageComponent implements OnInit { + laptops?:Laptop[] + constructor(private library : LibraryServiceService, private router:Router) { } + + ngOnInit(): void { + + this.library.dajLaptopove().subscribe(laptopovi =>{ + this.laptops = laptopovi + }) + } + + pogledaj(id:String) + { + this.router.navigate(["/laptop/"+id]) + } + + izmeni(laptop:Laptop) + { + this.router.navigate(['/izmeniLaptop/'+laptop.id]) + } + + obrisi(laptop:Laptop) + { + this.library.obrisiLaptop(laptop.id).subscribe(req=>{ + + this.library.dajLaptopove().subscribe(laptopovi =>{ + this.laptops = laptopovi + }) + }) + } + +} -- cgit v1.2.3