2016-03-24 29 views
1

我在邊緣出現此錯誤,但在chrome中一切正常 無法理解什麼是錯在這裏...在[background:url({{XXX}})無重複中心中心的嚴格模式中,不允許指定只讀屬性

<div class="container-fluid project_img" style="background: url({{_project.images.web}}) no-repeat center center;"> 
     </div> 

錯誤在微軟邊緣:

Assignment to read-only properties is not allowed in strict mode in [background: url({{_project.images.web}}) no-repeat center center; in ProjectDetailComponent 

回答

2

改用

<div class="container-fluid project_img" [style.background]="'url(' + _project.images.web + ') no-repeat center center;'"> 
    </div> 
+1

謝謝Thierry。 –

+0

感謝兄弟幫助 –

0

這是它的工作原理

<div class="container-fluid project_img" attr.style.background="url({{_project.images.web}}) no-repeat center center;"> 
+1

兩種風格都應該有效。你不能一起使用'[xxx] =「...」和「{{...}}」。 –

相關問題