【发布时间】:2017-01-23 03:55:43
【问题描述】:
我有组件:
@Component({
selector: 'my-selector',
template: `<div>html code goes here</div>
`,
host: {
'[style.background]': "'url(' + (myobj | async).background + ') 50% no-repeat'"
},
styleUrls: ['myComponent.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MyComponent {
@select(getMyobj)
myobj: Myobj;
}
我需要绑定到我的宿主元素背景。我在 rxjs 对象(Observable)中获取背景,所以我添加了“异步”,但我收到错误消息:“模板解析错误:管道‘异步’可以找不到”。
我怎样才能让它工作?
【问题讨论】:
-
不再支持这样做(异步或主机绑定中的任何管道)