![]() |
VOOZH | about |
The ng-srcset Directive in AngularJS is used to specify the srcset attribute of an <img> element, ie, overriding the original srcset attribute of an <img> element. It helps to ensure that the wrong image is not produced until AngularJS has been evaluated. This directive must be used instead of using the srcset, especially when the required AngularJS code is inside of the srcset value. It is supported by <img> and <source> element.
Syntax:
<img ng-srcset="url">
Parameter value:
Example 1: This example describes the implementation of the ng-srcset Directive in AngularJS.
Output:
Example 2: This is another example that illustrates the use of the AngularJS ng-srcset Directive.
Output: