snipt

Ctrl+h for KB shortcuts

HTML

AngularJS: ng-style with variable

<div ng-style="{'background-image': 'url(' + book.cover + ')'}"></div>
https://snipt.net/embed/f361a1f79ab16a484bede2fa39b7dc22/
https://snipt.net/raw/f361a1f79ab16a484bede2fa39b7dc22/
f361a1f79ab16a484bede2fa39b7dc22
html
HTML
1
2016-09-24T18:57:27
True
False
True
Jan 21, 2014 at 05:46 PM
/api/public/snipt/107609/
angularjs-ng-style-with-variable
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nt">&lt;div</span> <span class="na">ng-style=</span><span class="s">&quot;{&#39;background-image&#39;: &#39;url(&#39; + book.cover + &#39;)&#39;}&quot;</span><span class="nt">&gt;&lt;/div&gt;</span> </span></pre></div> </td></tr></table>
angularjs, ng-style, variable
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.