Ng-Src-1

 

Ng-Src is similar to src attribute of image tag. In this example of ng-src, we have a scope variable name "pic" and we are assigning its value to $scope.pic = "http://learnit.visrosoftware.com/datafiles/birds_009_big-400x400.jpg"; and binding it to image like

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </head> <body ng-app="Example"> <div class="container well" ng-controller="ExampleController"> <img ng-src="{{pic}}" /> </div> <script> var app = angular.module("Example", []); app.controller('ExampleController', ['$scope', function ($scope) { $scope.pic = "http://learnit.visrosoftware.com/datafiles/birds_009_big-400x400.jpg"; }]); </script> </body> </html>
Output