UNPKG

knowhow-server

Version:

A personal workflow engine that can manage and use any network connected host

31 lines (30 loc) 2 kB
<a href="http://github.com/angular/angular.js/tree/v1.2.9/src/ng/directive/booleanAttrs.js#L113" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/booleanAttrs.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngSrcset</code> <div><span class="hint">directive in module <code ng:non-bindable="">ng</code> </span> </div> </h1> <div><h2 id="description">Description</h2> <div class="description"><div class="ng-directive-page ng-directive-ngsrcset-page"><p>Using Angular markup like <code>{{hash}}</code> in a <code>srcset</code> attribute doesn&#39;t work right: The browser will fetch from the URL with the literal text <code>{{hash}}</code> until Angular replaces the expression inside <code>{{hash}}</code>. The <code>ngSrcset</code> directive solves this problem.</p> <p>The buggy way to write it: <pre class="prettyprint linenums"> &lt;img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/&gt; </pre> <p>The correct way to write it: <pre class="prettyprint linenums"> &lt;img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/&gt; </pre> </div></div> <h2 id="usage">Usage</h2> <div class="usage">as attribute<pre class="prettyprint linenums">&lt;IMG ng-srcset="{template}"&gt; ... &lt;/IMG&gt;</pre> <h3 id="usage_directive-info">Directive info</h3> <div class="directive-info"><ul><li>This directive executes at priority level 99.</li> </ul> </div> <h4 id="usage_directive-info_parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>ngSrcset</td><td><a href="" class="label type-hint type-hint-template">template</a></td><td><div class="ng-directive-page ng-directive-ngsrcset-page"><p>any string which can contain <code>{{}}</code> markup.</p> </div></td></tr></tbody></table></div> </div>