1

I wrote an angular single page application which generates a full HTML document as a string (from doctype to </html>). I would like to render that string at a given url (using ngroute?).

Currently, I populate an iframe on the same page with the generated string.

Is it possible to render a full HTML string document in angular?

Here are a snippet of the app:

appLSS.controller('ctlLSS', function($scope, $http, $sce, $location) {

    $scope.html_document = null;

    ...

    $scope.generate = function() {

        $scope.html_document = '<!doctype html><html> ... </html>';
        var frames = window.frames;
        frames[0].document.write($sce.trustAsHtml($scope.html_document));
    };
});
carloratm
  • 73
  • 5

1 Answers1

0

There is already a similar issue on Stackoverflow. You have to use ng-bind-html like it is explained here:

AngularJS: Insert HTML from a string

Community
  • 1
  • 1