I have 2 tables, one for vehicles and a company. If I click on the name of the vehicle, the corresponding company name will be indicated in the company table. So, now I have about 12 cars, when I click on the 12th vehicle, its name is displayed on the table of the Company, which is visible only when scrolling up. Therefore, I need to focus directly on the name of the company, and not on scrolling. Please, help
Here is my HTML code for Vehicle and Company:
Car table
<md-card *ngFor="let vehicle of vehicleLists | companyfilter:filter" (click)="goToCompany(vehicle)">
<div >
{{vehicle.vehicleName}}
</div>
</md-card>
Company table:
<md-card *ngFor="let company of companyLists | vehiclefilter:myfilter">
<div>
{{company.companyName}}
</div></md-card>
TS code:
goToCompany(vehicle){
this.document.body.scrollTop = 0;
}
Using the answer in this link, I was able to get my requirement:
Scroll up in angular2
, vwhicle, . . plunker , .
:
https://plnkr.co/edit/ZjZApeGBk1P6OamYv21T?p=preview
, .