-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82e9161
commit bdbef17
Showing
12 changed files
with
83 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<main> | ||
<section> | ||
<router-outlet></router-outlet> | ||
</section> | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="mdl-grid" *ngIf="vehicle"> | ||
<div class="mdl-cell mdl-cell--4-col"> | ||
<img [src]='vehicle.picture' border="0" alt="" style="width:100%"> | ||
</div> | ||
<div class="mdl-cell mdl-cell--8-col"> | ||
|
||
<p>{{vehicle.make}} {{vehicle.model}}</p> | ||
|
||
<p>Type: {{vehicle.type}}</p> | ||
|
||
<p>License Plate: {{vehicle.licensePlate}}</p> | ||
|
||
<p>Seats: {{vehicle.seats}}</p> | ||
|
||
<p>Rating: {{vehicle.rating}}</p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Component, OnInit } from 'angular2/core'; | ||
import { Router, RouteParams } from 'angular2/router'; | ||
import { Vehicle } from './vehicle'; | ||
import { VehiclesService } from './vehicles.service'; | ||
|
||
@Component({ | ||
selector: 'vehicle-detail', | ||
templateUrl: 'app/vehicles/vehicle-detail.component.html' | ||
}) | ||
export class VehicleDetailComponent { | ||
|
||
public vehicle: Vehicle; | ||
|
||
constructor(private _router: Router, | ||
private _routeParams: RouteParams, | ||
private _vehiclesService: VehiclesService) { } | ||
|
||
ngOnInit() { | ||
this._getVehicle(); | ||
} | ||
|
||
private _getVehicle() { | ||
let id = +this._routeParams.get('id'); | ||
this._vehiclesService.getVehicle(id).then(vehicle => this.vehicle = vehicle); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
Vehicles/app/vehicles/vehicles-list.css → .../app/vehicles/vehicles-list.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
|
||
.list-max-width img { | ||
width: 100%; | ||
height: auto; | ||
} | ||
|
||
.mdl-cell--col-3 { | ||
width: 25%; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="mdl-grid list-max-width"> | ||
<div class="mdl-cell mdl-cell--3-col mdl-card mdl-shadow--4dp" *ngFor="#vehicle of vehicles" (click)="onSelect(vehicle)"> | ||
<div class="mdl-card__media"> | ||
<img class="article-image" [src]="vehicle.picture" border="0" alt="" /> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import {Injectable} from 'angular2/core'; | ||
import {VehiclesList} from './mock-vehicles'; | ||
import { Injectable } from 'angular2/core'; | ||
import { VehiclesList } from './mock-vehicles'; | ||
|
||
@Injectable() | ||
export class VehiclesService { | ||
|
||
getVehicles() { | ||
return Promise.resolve(VehiclesList); | ||
} | ||
|
||
getVehicle(id: number) { | ||
let vehicle = VehiclesList.filter(x => x.id == id); | ||
return Promise.resolve(vehicle[0]); | ||
} | ||
} |