tag I would like to use angular ngRepeat or similar to create som...">

Best way to ng repeat information inside <pre class = "prettyprint-override"> tag

I would like to use angular ngRepeat or similar to create some formatted text inside the "pre" block. For example, something like this:

function MyController($scope)
{
   $scope.data = [{test:'one', children:[...]},{test:'two', children:[...]}]; 
}

<pre>
  {{ngRepeat item in data}}
  {{item.test}}
       {{ngRepeat child in item.children}}
           {{child.title}}
       {{/ngRepeat}}
  {{/ngRepeat}}
</pre>

Obviously, I could just create a string, but I'm curious if there is a way to do this in angular templates.

+4
source share
1 answer

This cannot be done, you must have a parent to repeat - I recently tried the same thing.

My decision was

<mytag ng-repeat="x in y">{{x}}</mytag>
+1
source

All Articles