View source Improve this doc

ngSrc
directive in module ng

Description

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}}. The ngSrc directive solves this problem.

The buggy way to write it:

<img src="http://www.gravatar.com/avatar/{{hash}}"/>

The correct way to write it:

<img ng-src="http://www.gravatar.com/avatar/{{hash}}"/>

Usage

as attribute
<IMG ng-src="{template}">
   ...
</IMG>

Parameters

ParamTypeDetails
ngSrctemplate

any string which can contain {{}} markup.