我有以下组件模板:
<h1>Complexus Vehicle Inventory</h1>
<p *ngIf="!vehicles"><em>No vehicle entries found</em></p>
<div *ngIf="vehicles">
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" [(ngModel)]="strMakeOrModel" name="search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" (click)="searchVehicle()">Search</button>
</form>
</div>
<table class="table" *ngIf="vehicles">
<thead class="thead-dark">
<tr>
<th scope="col">Make</th>
<th scope="col">Model</th>
<th scope="col">Engine Capacity</th>
<th scope="col">Cylinder Variant</th>
<th scope="col">Top Speed</th>
<th scope="col">Price (R)</th>
<th scope="col">Cylinder Capacity</th>
<th scope="col">Air Pressure/second</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let vehicle of vehicles">
<td>{{ vehicle.Make }}</td>
<td>{{ vehicle.Model }}</td>
<td>{{ vehicle.EngineCapacity }}</td>
<td>{{ vehicle.CylinderVariant }}</td>
<td>{{ vehicle.TopSpeed }}</td>
<td>{{ vehicle.Price }}</td>
<td>{{ vehicle.IndividualCylinderCapacity }}</td>
<td>{{ vehicle.AirPressurePerSecond }}</td>
</tr>
</tbody>
</table>
我希望能够根据在导航栏中单击的导航链接更改表单中的搜索条件。换句话说,假设有人点击了按价格搜索,上面的组件现在应该更新为包含两个文本框,服务于他们想要搜索的价格范围。
表格布局将保持不变,因此这是组件的可重用部分。
你如何在 Angular 6 中实现这一点?