2017-02-22 13:13:21 -05:00
|
|
|
// #docplaster
|
|
|
|
// #docregion
|
|
|
|
declare var angular: angular.IAngularStatic;
|
|
|
|
import { downgradeComponent } from '@angular/upgrade/static';
|
|
|
|
import { Component } from '@angular/core';
|
|
|
|
|
|
|
|
import { Phone, PhoneData } from '../core/phone/phone.service';
|
|
|
|
import { RouteParams } from '../ajs-upgraded-providers';
|
|
|
|
|
|
|
|
@Component({
|
2017-04-13 17:35:13 -04:00
|
|
|
templateUrl: './phone-detail.template.html',
|
2017-02-22 13:13:21 -05:00
|
|
|
})
|
|
|
|
export class PhoneDetailComponent {
|
|
|
|
phone: PhoneData;
|
|
|
|
mainImageUrl: string;
|
|
|
|
|
|
|
|
constructor(routeParams: RouteParams, phone: Phone) {
|
|
|
|
phone.get(routeParams['phoneId']).subscribe(phone => {
|
|
|
|
this.phone = phone;
|
|
|
|
this.setImage(phone.images[0]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
setImage(imageUrl: string) {
|
|
|
|
this.mainImageUrl = imageUrl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
angular.module('phoneDetail')
|
|
|
|
.directive(
|
|
|
|
'phoneDetail',
|
|
|
|
downgradeComponent({component: PhoneDetailComponent}) as angular.IDirectiveFactory
|
|
|
|
);
|