Angularjs - How to compile an ajax html response through a controller? -


I am using a gist command that is failing when I compile an Ajax response of a controller .

Instructional instructions here:

  Angular Module ('abstract', []); (Written: 'gt;'), link: function (scope) iframe.setAttribute ('width', '100%'); Iframe.setAttribute ('frameborder', '0', 'flam', '0'; Iframe.id = "gist-" + gistId; elm [0] .appendChild (iframe); var iframeHtml = '& lt; html & Gt; & gt; Head & gt; Base Target = "_parent" & gt; & gt; Style & gt; Table {Font-size: 12px;}   ; & Lt; body onload = "parent.document.getElementById" (\ '' + iframe.id + '\') style.heat = document.body .scrollHeight + \ 'px \' "& gt; & lt; Scr '+' ipt type = "text / javascript" src = "https://gist.github.com/ '+ gistId +' .js" & gt; & lt; / Sc '+' ript & gt; & lt ; / Body & gt; & lt; / html>; var doc = iframe.document; if (iframe.contentDocument) doc = iframe.contentDocument; and if (iframe.contentWindow) do C = iframe.contentWindow.document ; Doc.open (); doc.writeln (iframeHtml); doc.close ();}};});   

And here's my controller:

  angular module ('spa2App'). Controller ('BlogEntryCtrl', ['$ scope', '$ path perm ',' $ Compiling ',' blog entry ', function ($ scope, $ route perm, $ compilation, blogentry) {$ scope.Blog = BlogEntry.get ({EntryID: $ routeParams.EntryID}, function ($ resource ) {Var dateTs = parseInt ($ resource PubDate.match (/ [0-9 -] + /) [0]); $ Resource Pubdate = new date (dateTs); $ Resource.Content = $ Collection ($ resource.Content) ($ Range);});}]);  

My view:

  & lt; Div ng-bind-html = "blog.content" & gt; & Lt; / Div & gt;  

When I tried to compile html content with ezax response, I got an error from the doctor, because iframe is not available. I have read that this is because iframe is to be injected into the body, but if I do this then it goes into a compilation loop.


Comments