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