WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-srcset Directive


Example

Add a picture, where the srcset is assessed by AngularJS:

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

Definition and Usage

The ng-srcset order supersedes the first srcset characteristic of an element.

The ng-srcset order ought to be utilized rather than srcset on the off chance that you have AngularJS code inside the srcset value.

The ng-srcset order ensures the picture isn't shown wrong before AngularJS has assessed the code.


Syntax

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

Supported by the <img> and <source> elements.


Parameter Values

Value Description
string A string esteem, or an articulation bringing about a string.