Suppose I have a component with the following property:
import { Component, OnInit } from 'angular2/core';
import { CarService } from 'someservice';
@Component({
selector: 'car-detail',
templateUrl: './app/cars/car.component.html'
})
export class CarComponent implements OnInit {
model: Observable<Car>;
constructor(
private _carService: CarService
) { }
ngOnInit() {
// Initialize model data
this.model = this._carService.get(5);
}
}
If I want to subscribe to this in my view and use the properties as text using an async pipe, how can I achieve that? For example:
<template #mycar = "model | async" >
<p>{{ myCar?.make }}</p>
</template>
I am new to Angular2 and uncertain if I am implementing this correctly or not.