ຄຳສັ່ງ ng-srcset AngularJS

definition and usage

ng-srcset Directive will override the original srcset attribute.

If the srcset value contains AngularJS code, then it should be used ng-srcset Directive replaces srcset.

ng-srcset Directives ensure that the image will not be displayed incorrectly before the AngularJS code is evaluated.

Example

Add an image where srcset is calculated by AngularJS:

<div ng-init="myVar = 'pic_angular.jpg'">
    <h1>Angular</h1>
    <img ng-srcset="{{myVar}}">
</div>

Try it yourself

Syntax

<img ng-srcset="string</img>

Affected <img> and <source> Element Support.

Parameters

Parameters Description
string String value, or expression result is a string.