json - parse html within ng-repeat -


I am searching for hours now and I can not find that ng-repeat on parsing the HTML code. I've checked $ sce.trustAsHtml but I do not know how to implement it in my code.

html file:

  & lt; Div ng-app = "myApp" & gt; & Lt; Div ng-controller = "MyCtrl" & gt; & Lt; H2 & gt; My link & lt; / H2 & gt; & Lt; Table class = "table-table-range" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; TD & gt; Name & lt; / TD & gt; & Lt; TD & gt; Url & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; Tr ng-repeat = "Accessories in myStuff ()" & gt; & Lt; TD & gt; {{Stuff.name}} & lt; / TD & gt; & Lt; TD & gt; {{Stuff.url}} & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt;  

Javascript

  var myApp = angular.module ('myApp', []); MyApp.controller ('MyCtrl', function ($ scope) {$ scope.mystuff = function () {Return to [{'name': 'Google', 'url': '& lt; a href = "http: // Google com "& gt; Google & lt; / a & gt; '}, {' name ':' Yahoo ',' url ': & lt; a href =" http://yahoo.com "& gt; Yahoo & lt; / a & gt; '}, {' Name ':' Microsoft ',' URL ':' & lt; a href = "http://microsoft.com" & gt; Microsoft & lt; / a This HTML source is displaying, but I have to compile this code. Is my JS wrong? I have it in a JSO file. Putting the http http command I am using once I understand it Can someone put some light on this?  

Thanks.

script included And add dependency to your module.

  var myApp = angular.module ('myApp', [ngSanitize ']);  

and use just

  & lt; td ng-bind-html = "stuff.url">   

and you Good to go: -

In what you are doing, html binding element will be displayed as textcontent, while interpolation instructions Door Will be processed.


Comments

Popular posts from this blog

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

c# - Process.Kill() returns access denied -

c# - Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments -