0

so with this angularjs ng-repeat

<li ng-repeat="result in results">

where result is a nested object with 10 levels

{
  "level1":{
           "level2":{
           ....
                         "level10":{
                                "myField":"myValue"
                                 }
                  }
           }
}

so inside this ng-repeat element I will need to do

<span ng-bind-html-unsafe="result.level1.somefield | somefilter"></span> 
 <span ng-bind-html-unsafe="result.fields......level10.myField"  | somefilter></span> 

Note: I need both level 10 stuff and other level's stuff in the same iteration

Logically I need something like this

var level10Object = result......level10.object

<span ng-bind-html-unsafe="result.level1.somefield | somefilter"></span> 
 <span ng-bind-html-unsafe="level10Object.myField  | somefilter"></span> 

Of course usually that wont be really that much levels, just to illustrate my point.

I am quite new to Angular, so any expression / tricks will let me do that? I think that can make the template more decouple to the object structure Performance is a concern.

4

0 回答 0