Blame view
src/app/component/list-vessel/list-vessel.component.ts
1.3 KB
9bbae2409 highlight selecte... |
1 |
import {Component, OnInit} from '@angular/core'; |
c4e931730 add vessel list |
2 |
import {VesselsService} from '../../service/vessels.service'; |
de59ffef8 add model + search |
3 |
import {Vessels} from '../../model/vessels'; |
9bbae2409 highlight selecte... |
4 5 |
import {Vessel} from '../../model/vessel'; import {SelectedVesselService} from '../../service/selected-vessel.service'; |
287033a62 add vessel positi... |
6 |
|
de59ffef8 add model + search |
7 |
declare var $: any; |
632c4ac2f import vessels |
8 9 10 11 12 13 14 |
@Component({ selector: 'app-list-vessel', templateUrl: './list-vessel.component.html', styleUrls: ['./list-vessel.component.scss'] }) export class ListVesselComponent implements OnInit { |
de59ffef8 add model + search |
15 |
vessels: Vessels; |
9bbae2409 highlight selecte... |
16 |
selectedVessel: Vessel; |
632c4ac2f import vessels |
17 |
|
9bbae2409 highlight selecte... |
18 |
constructor(private vesselsService: VesselsService, private selectedVesselService: SelectedVesselService) { |
632c4ac2f import vessels |
19 |
} |
c4e931730 add vessel list |
20 21 |
ngOnInit(): void { this.vesselsService.currentVessels.subscribe(vessels => { |
287033a62 add vessel positi... |
22 23 24 |
setTimeout(() => this.vessels = vessels ); |
de59ffef8 add model + search |
25 |
}); |
9bbae2409 highlight selecte... |
26 27 28 |
this.selectedVesselService.currentVessel.subscribe(selectedVessel => { this.selectedVessel = selectedVessel; }); |
de59ffef8 add model + search |
29 30 31 32 33 34 35 |
$(document).ready(() => { $('#myInput').on('keyup', function(): void { const value = $(this).val().toLowerCase(); $('#list-tab a').filter(function(): void { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); }); }); |
c4e931730 add vessel list |
36 37 |
}); } |
287033a62 add vessel positi... |
38 |
|
9bbae2409 highlight selecte... |
39 40 41 |
onSelectVessel(vessel: Vessel): void { this.selectedVesselService.changeVesselSet(vessel); } |
632c4ac2f import vessels |
42 |
} |