我试图以这种方式将元素getBoundingClientRect()发送到我的组件:
<object [fromTop]="element.getBoundingClientRect().top"></object>
在我的组件html中我这样做,因为我得到一个说明它“不安全”
this.fromTop = this.sanitizer.bypassSecurityTrustStyle(this.fromTop); <div style="position:absolute;top:{{fromTop}}px;">Top:{{fromTop}}</div>
但添加消毒剂后,我收到以下消息:
SafeValue must use [property]=binding:
怎么了?如何让我的对象处于一个绝对位置,等于顶部:{{fromTop}} px?