web-dave / ng-essential-workshop

0 stars 0 forks source link

Create a vehicle-preview Component #12

Open web-dave opened 4 years ago

web-dave commented 4 years ago
web-dave commented 4 years ago

generate

  ng g c fleet/vehicle-preview
web-dave commented 4 years ago

vehicle-preview.component.html

<ul *ngIf="vehicle">
  <li>{{vehicle.model}}</li>
  <li>{{vehicle.make}} <button (click)="selectThisVehicle()" class="btn btn-info">show me more</button></li>
</ul>
web-dave commented 4 years ago

vehicle-list.component.html

  <div *ngIf="vehicles">
    <vehicle-preview *ngFor="let vehicle of vehicles" [vehicle]="vehicle" (vehicleselected)="selectVehicle($event)"></vehicle-preview>
  </div>
web-dave commented 4 years ago

vehicle-list.component.ts

  selectVehicle(vehicle) {
    console.log(vehicle);
  }
web-dave commented 4 years ago

NEXT