VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-src-directive/

⇱ AngularJS ng-src Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-src Directive

Last Updated : 11 Jul, 2025

The ng-src Directive in AngularJS is used to specify the src attribute of an <img> element, ie., it overrides the original src attribute for an <img> element. This attribute must be used if we have the Angular code inside of the src element. It ensures that the wrong image is not produced until AngularJS has been evaluated. It is supported by <img> element. 

 

Syntax:

<img ng-src="url">

Parameter value:

  • url: This parameter specifies that the URL can be a string or any expression that is resulting in a string.

Example: This example describes the usage of the ng-src Directive in AngularJS.

Output:

👁 Image
 

Example 2: This is another example that describes the usage of the ng-src Directive in AngularJS.

Output:

👁 Image
 
Comment

Explore