Ok, I got it working as a directive.
It’s working great, and doesn’t need $compile nor $timeout.
On the directive’s file:
.directive('dynamicUrl', [function () {
return {
restrict: 'A',
link: function postLink(scope, element, attr) {
element.attr('src', attr.dynamicUrlSrc);
}
}
}])
On the template file:
<iframe src="" dynamic-url dynamic-url-src="{{URL}}" frameborder="0" allowfullscreen></iframe>
The solution came from:
EDIT: Sorry, it DOES needs $timeout… If its triggered without it, it will be too fast, and the DOM wont have been updated yet. See my plnkr in the post below for a working solution.