WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-src Directive


Example

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

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

Definition and Usage

The ng-src mandate abrogates the first src property of a <img> element.

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

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


Syntax

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

Supported by the <img> element.


Parameter Values

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