Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

AngularJS | ng-src Directive

  • Last Updated : 28 Mar, 2019

The ng-src Directive in AngularJS is used to specify the src attribute of an <img> element. It ensures that the wrong image is not produced until AngularJS has been evaluated. It is supported by <img> element.


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


<!DOCTYPE html>
        <title>ng-src Directive</title>
        <script src=
    <body ng-app="app" style="text-align:center">
      <h1 style="color:green">GeeksforGeeks</h1>
      <h2>ng-src Directive</h2>
        <div ng-controller="geek">
            <img ng-src="{{pic}}" /><br><br><br>
            var app = angular.module("app", []);
            app.controller('geek', ['$scope', function ($scope) {
                $scope.pic = 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!