Here is my code如何使用NG-風格,同時從JSON歌廳風格
這是我的代碼ng-style="background: {{x.background}}"
什麼使ng-style="background: #f4f4f4"
我期待style="background: #f4f4f4"
Here is my code如何使用NG-風格,同時從JSON歌廳風格
這是我的代碼ng-style="background: {{x.background}}"
什麼使ng-style="background: #f4f4f4"
我期待style="background: #f4f4f4"
我認爲正確的指令是ng-attr-style
,檢查documentation
變化這個
ng-style="background: {{x.background}}"
到
ng-attr-style="background: {{x.background}}"
試試這個:
ng-style="{ background: x.background}"
這更加嚴密類似json的。實際上你可以有一個json對象並直接使用它。
始終在StackOverflow中發佈相關代碼。人們通常不關心你是否與其他網站「鏈接」。請查看[如何使用Markdown或HTML格式化我的帖子](http://stackoverflow.com/help/formatting)以獲取有關在SO上格式化代碼的更多信息。 – Sufian