5
我想一個元素getBoundingClientRect()這種方式發到我的組件:警告:SafeValue必須使用[屬性] =結合
<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必須使用[屬性] =結合:
怎麼了?我如何讓我的對象處於等於頂部的絕對位置:{{fromTop}}px?
這是在safari和IE的工作嗎? –
這沒什麼特別的。這絕對適用於Safari和IE。你爲什麼問?你有什麼特別的問題嗎? –
沒有特別的問題。 bypassSecurityTrustStyle它不適用於IE,Edge和safari。 –