Is it possible / and how / to write inline css style using angular variables?
<div style="background: transparent url({{eventInfo.eventHeaderImg}}) top center no-repeat;"></div>
This is my output
"NetworkError: 404 Not Found - http://test/eventInfo.eventHeaderImg"
So I see it didn't render this value.
I know it's possible to change this in controller, but is it doable with my approach?
an example: http://plnkr.co/edit/qT8skZzTwXjrh3Ye5mr9?p=preview
<div ng-style="{ background: 'transparent url({{ eventInfo.eventHeaderImg }}) top center no-repeat' }"></div>
这对我有用:
<div ng-style="{ 'background': 'transparent url(' + eventInfo.eventHeaderImg + ') top center no-repeat' }"></div>
You're "writing" a wrong url in your style, that's why you've got a 404
(not found) error.
According to this plunker , if you're $scope
is well set up, you print the right data in style
attribute.
Note that your eventInfo
scope variable has to be a map/object.
您不需要在那里使用双卷曲支架。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.