AngularJS - Change content in iframe or similar

Viewed 2505

Here is a JSFiddle to start with.

HTML

<iframe id="iframe" src="http://fiddle.jshell.net/"></iframe>
<div id="test">click me</div>

jQuery

$( "#test" ).on( "click", function() {
    var iframe = $("#iframe").contents();
    iframe.find('#header').css('background-color', 'red');
    iframe.find('#header').html('My content');
});

CSS

iframe {
    height: 500px;
    width: 800px;
}

Question

  • In the above example I can, with jQuery, edit the DOM content of an iframe without any problems.
  • Can the same be done with AngularJS? Example?
  • If not, can it be done with ngInclude? Example?
1 Answers
Related