2017-02-22 13:13:21 -05:00
|
|
|
// #docplaster
|
|
|
|
// #docregion
|
|
|
|
import { Component } from '@angular/core';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
|
|
|
import { Phone, PhoneData } from '../core/phone/phone.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'phone-detail',
|
|
|
|
templateUrl: './phone-detail.template.html'
|
|
|
|
})
|
|
|
|
export class PhoneDetailComponent {
|
|
|
|
phone: PhoneData;
|
|
|
|
mainImageUrl: string;
|
|
|
|
|
|
|
|
constructor(activatedRoute: ActivatedRoute, phone: Phone) {
|
2017-06-18 22:09:02 -04:00
|
|
|
phone.get(activatedRoute.snapshot.paramMap.get('phoneId'))
|
2017-02-22 13:13:21 -05:00
|
|
|
.subscribe((p: PhoneData) => {
|
|
|
|
this.phone = p;
|
|
|
|
this.setImage(p.images[0]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
setImage(imageUrl: string) {
|
|
|
|
this.mainImageUrl = imageUrl;
|
|
|
|
}
|
|
|
|
}
|