Instead of using 'link', use the 'compile' function, since you essentially want to change the HTML before embedding in the DOM. I think a βlinkβ is inserted and then attached to the area.
So, with link 1. compilation is called from {{url}} - the iframe request is executed 2. the link is called, and {{url}} is replaced, so you are the second call.
If you use "compilation", you can change the src attribute yourself.
Give a http://docs.angularjs.org/guide/directive look, hope this helps
Edit Check out this script http://jsfiddle.net/jbSx6/20/
return { restrict: 'E', require: '?ngModel', replace: true, transclude: true, template: '<iframe src="%url%" height="100%" width="100%" frameborder="0"></iframe>', compile: function (element, attrs, transclude) { console.log(element[0].outerHTML); element[0].outerHTML = element[0].outerHTML.replace('%url%',attrs.iframeSrc); console.log(element); } }; <div ng-app="myApp"> <div>display google in frame</div> <my-frame data-iframe-src="http://jsfiddle.net">test</my-frame> </div>
source share