Saturday, 15 January 2011

javascript - angularjs ng-style: background-image isn't working -


I try angular ng-style using a background image on a div (I tried a custom command before the same behavior), but it does not work.

  & lt; Nav class = "navigation-grid-container" data-ng-class = "{bigger: isNavActive == true}" data-ng-controller = "navigation" Ctrl + data-ng-mouseenter = "isNavActive = true; $ parent .isNavActive = true "Data-ng-mouseleave =" hinvative = false; $ parent.isNavActive = false "data-ng-show =" $ parent.navInvisible == incorrect "data-ng-anamet =" 'feed' "ng -clock & gt; & Lt; Ul class = "navigation-container unstitched cleanfix" & gt; Navigation "Data-ng-square =" {small: $ parent.isNavActive, big: isActive == true} in & lt; Li class = "navigation-item-container" data-ng-repeat = "(key, item)" Data-ng-mouseenter = "isActive = true; isInactive = false" data-ng-mouseleave = "active = falls; isInactive = True "& gt; & Lt; Div on data-ng-switch = "item.id" & gt; & Lt; Div class = "navigation-item-default" data-ng-switch-when = "scandinavia" & gt; & Lt; A class = "navigation-item-overlay" data-ng- href = "{{item.id}}" & gt; & Lt; Div class = "navigation-item-teaser" & gt; & Lt; Span class = "navigation-item-teaser-text" data-ng-class = "{small: iscandinavia}" & gt; {{Item.teaser}} & lt; / Span & gt; & Lt; / Div & gt; & Lt; / A & gt; & Lt; Span class = "navigation-item-background" data-ng-style = "{'background-image': 'public / img / products / {{item.id}} / expand / expand / {{item.detail. Wide [0]}} '} "& gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; Div class = "navigation-item-last" data-ng-switch-when = "static" & gt; & Lt; Div class = "navigation-item-overlay" & gt; & Lt; Div class = "navigation-item-teaser" & gt; & Lt; Span class = "navigation-item-teaser-text" & gt; & Lt; Img data-ng-src = "{{item.teaser}}" & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Span class = "navigation-item-background" & gt; & Lt; Img class = "logo" data-ng-src = "{{item.images.logo}}" & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; Div class = "navigation-item-default" data-ng-switch-default & gt; & Lt; A class = "navigation-item-overlay" data-ng- href = "{{item.id}}" & gt; & Lt; Div class = "navigation-item-teaser" & gt; & Lt; Span class = "navigation-item-teaser-text" & gt; {{Item.teaser}} & lt; / Span & gt; & Lt; / Div & gt; & Lt; / A & gt; & Lt; Span class = "navigation-item-background" data-ng-style = "{'background-image': 'public / img / products / {{item.id}} / expand / expand / {{item.detail. Wide [0]}} '} "& gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Neo & gt;   

However, if I try to color the background, then it is working fine. I tried a remote source and local source also tried http://lorempixel.com/g/400/200/sports/ , did not work either. Background image: URL (correct syntax for "path_to_image") =

Class = "text");

The correct syntax for ng-style is:

  ng-style = "{'background-image': 'url (https: // www Google.com/images/srpr/logo4w.png)'}">    

No comments:

Post a Comment