AngularJS Built-in directives ngSrc


Using Angular markup like {{hash}} in a src attribute doesn't work right. The browser will fetch from the URL with the literal text {{hash}} until Angular replaces the expression inside {{hash}}. ng-src directive overrides the original src attribute for the image tag element and solves the problem

<div ng-init="pic = 'pic_angular.jpg'">
    <img ng-src="{{pic}}">