angularjs NG风格的背景不工作 [英] angularjs ng-style doesn't work on background
本文介绍了angularjs NG风格的背景不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在另一个线程我得到的背景可以用毫克式动态设置的信息。可惜我不能得到它的工作。
On another thread I got the information that the background can be set dynamically by using mg-style. Unfortunately I can't get it work.
语法如下:
ng-style="{'background-image':'url(https://www.google.com/images/srpr/logo4w.png)'}"
我有一个用于测试的小提琴:小提琴
提琴:
<ion-item class="item-icon-right item-avatar defaultItem" data-ng-repeat="item in items " data-ng-style="{'background-image':'url({{item.url}})'}">
离子项的背景图像应该被设置为毫克式元件
The background-image of the ion-item should be set to the mg-style element.
推荐答案
看到其他地方(<一个href=\"http://forum.ionicframework.com/t/ng-style-background-image-not-being-applied-on-initial-load/17764/2\"相对=nofollow>离子论坛 - 信贷maxx0r ):不使用NG-的风格,但风格代替。这已为我工作。
所以,你的例子应该如下改变:
Seen elsewhere (Ionic Forums - credit to maxx0r) : don't use ng-style but style instead. That has worked for me. So your example should change as follows:
<ion-item class="item-icon-right item-avatar defaultItem" data-ng-repeat="item in items " style="background-image:url({{item.url}})">
HTH,最诚挚的问候。
HTH, best regards.
这篇关于angularjs NG风格的背景不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文