AngularJS ng-srcset Directive
The AngularJS ng-srcset directive is used to solve the problem where original srcset attribute doesn’t work properly. AngularJS ng-srcset overrides the original srcset attribute of an element.
The ng-srcset directive should be used instead of srcset when you have AngularJS code inside the srcset value. It ensures that the image is not displayed wrong before AnglarJS code is executed.
It is supported by <image> and <source> element.
The wrong way to write this:
The right way to write this:
string: It specifies a string value, or an expression resulting in a string.
Let’s take an example to demonstrate the usage of ng-srcset directive.
See this example: