I have created this interface:
interface IGame {
name: string;
description: string;
}
I'm using it as an Observable and passing it as Input
to the Component
:
@Input() public game: Observable<IGame>;
I can see its value printed using the JSON pipe:
<h3>{{game | json}}</h3>
When binding to a specific property, nothing is displayed (just an empty string):
<h3>{{game.name}}</h3>
<h3>{{game.description}}</h3>
The async
pipe does the subscription in view bindings
<h3>{{(game | async)?.name}}</h3>
The ?
is only necessary when null
values might be emitted.