UPDATE: Solution added below as answer
Im building a snippets manger using angularJS and Ace editor. I have two tabs for CSS and HTML and I want to make a preview tab based on the input of the user, similar to the way http://bootsnipp.com/ works. I have a preview working by injecting the CSS code into a style tag:
<div>
<style>
{{snippetsCtrl.snippet.css}}
</style>
<div ng-bind-html="snippetsCtrl.snippet.html">
</div>
</div>
But I know this is a bad idea, and it effects the rest of the app, for example if the user adds
body { display: none; }
the screen goes blank.
I tried using an iframe but I cant figure out how to make the iframe work with angular.
So any suggestions on how to take the code in the $scope and apply it to an iframe??