javascript - How can I get angular dynamic content to display in an iframe? -


i generating tabular content using ng-repeat in angularjs, , have content display in iframe, user can drag , resize it.

i can't use iframe src attribute, because requires url , generating content on client.

i want variant of srcdoc, seems want single quoted line of html code.

how can construct iframe such ng-repeat generated content displayed within?

you can add angularjs table iframe. support limited html5 looks this:

html

<iframe id="frame" sandbox="allow-same-origin allow-scripts" srcdoc="" seamless="true"></iframe> 

javascript

document.getelementbyid("frame").contentwindow.document.getelementbyid("mydiv") 

the srcdoc property can used instead of src indicate providing code contents. seamless expected when use srcdoc; tells browser iframe's contents supposed treated part of website, rather nested one. unfortunately, trigger styling changes eliminate whole reason wanted iframe in first place (the resize handles disappear). furthermore, you'd have inject css files , javascript files iframe - it's not worth it.

i'd recommend using jquery ui resizable: https://jqueryui.com/resizable/

here's fiddle using test out controlling iframe contents. it's basic accurately demonstrates how trouble are: fiddle


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -