我创建了这个界面:
interface IGame {
name: string;
description: string;
}
我将它用作 Observable 并将其传递为Input
to the Component
:
@Input() public game: Observable<IGame>;
我可以看到它使用 JSON 管道打印的值:
<h3>{{game | json}}</h3>
绑定到特定属性时,不会显示任何内容(仅显示空字符串):
<h3>{{game.name}}</h3>
<h3>{{game.description}}</h3>
The async
pipeline 在视图绑定中进行订阅
<h3>{{(game | async)?.name}}</h3>
The ?
仅当需要时null
可能会发出值。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)