0

I am just trying to put a path and file extension around an expression ng-src like so:

<iframe src="'path/' + pattern.anchor + '.html'">

which would ideally resolve to:

<iframe src="path/name.html">

if pattern.anchor is set to "name". I have no problem with the expression showing up elsewhere in my template. If I leave src="{{pattern.anchor}} then I get src="name", which is great but of course not what I need.

Any reason why this is not working?

Bice
  • 149
  • 12
  • 1
    You meantioned `ng-src`, why are you still using `src` as the attribute instead of `ng-src`? Using ` – Liam Gray Aug 31 '15 at 22:58

1 Answers1

1

Try

<iframe src="{{ 'path/' + pattern.anchor + '.html' }}">

or create the path and assign it to a $scope variable and just point it at that.

You might want to actually use ng-src instead of src. Using src doesn't know to use ng-src, and ng-src will be more reliable, if it works for iframes, which I haven't confirmed.

Timothy
  • 1,198
  • 3
  • 10
  • 30