diff options
Diffstat (limited to 'sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop')
4 files changed, 118 insertions, 0 deletions
diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css new file mode 100755 index 00000000..6d5e47ba --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.css @@ -0,0 +1,22 @@ +table { +    border-collapse: collapse; +    width: 100%; +    border: 1px solid green; +    margin-top:15px; +  } + +th{ +    border:1px solid green; +    height: 30px; +    background-color:springgreen; +} + +td{ +    border:1px solid salmon; +    height: 30px; +    text-align: center; +} +#forma{ +    width: 250px; +    margin: auto; +}
\ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html new file mode 100755 index 00000000..e1f90df3 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.html @@ -0,0 +1,41 @@ +<div *ngIf="laptop" id="forma"> +    <h4>Karakteristike laptopa:</h4> +  <b>Brend:</b> {{laptop.brand}}  <br> +  <b>Model</b>: {{laptop.model}} <br> +  <b>RAM</b>: {{laptop.ram}} GB<br> +  <b>HDD</b>: {{laptop.hdd}} GB<br> +  <b>Grafika</b>: {{laptop.graphics}} (GB)<br> +  <b>Dijagonala ekrana</b>: {{laptop.display}} "<br> +  <b>Procesor</b>: {{laptop.processor}} <br> +  <b>Cena</b>: {{laptop.price}} €<br><br> + + +  <table *ngIf="laptopoviM"> +    <tr> +        <th colspan="9">LAPTOPOVI MARKE {{laptop.brand}}</th> +    </tr> +    <tr> +        <th>Brend</th> +        <th>MODEL</th> +        <th>RAM</th> +        <th>HDD</th> +        <th>Grafika</th> +        <th>Dijagonala ekrana</th> +         +        <th>Procesor</th> +        <th>Cena</th> +    </tr> +    <tr *ngFor="let laptop of laptopoviM" (click)="pogledaj(laptop.id)"> +        <td>{{laptop.brand}}</td> +        <td>{{laptop.model}}</td> +        <td>{{laptop.ram}}</td> +        <td>{{laptop.hdd}}</td> +        <td>{{laptop.graphics}}</td> +        <td>{{laptop.display}}</td> +        +        <td>{{laptop.processor}}</td> +        <td>{{laptop.price}} €</td> +    </tr> +</table> +</div> +<router-outlet></router-outlet>
\ No newline at end of file diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts new file mode 100755 index 00000000..a9ef8a05 --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LaptopComponent } from './laptop.component'; + +describe('LaptopComponent', () => { +  let component: LaptopComponent; +  let fixture: ComponentFixture<LaptopComponent>; + +  beforeEach(async () => { +    await TestBed.configureTestingModule({ +      declarations: [ LaptopComponent ] +    }) +    .compileComponents(); +  }); + +  beforeEach(() => { +    fixture = TestBed.createComponent(LaptopComponent); +    component = fixture.componentInstance; +    fixture.detectChanges(); +  }); + +  it('should create', () => { +    expect(component).toBeTruthy(); +  }); +}); diff --git a/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts new file mode 100755 index 00000000..94d711bb --- /dev/null +++ b/sandbox/TestIvanLjubisavljevic/frontend/src/app/laptop/laptop.component.ts @@ -0,0 +1,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]) +  } +}  | 
