How to use ng-repeat without an html element

后端 未结 8 1532
暖寄归人
暖寄归人 2020-11-30 23:35

I need to use ng-repeat (in AngularJS) to list all of the elements in an array.

The complication is that each element of the array will transform to ei

8条回答
  •  时光说笑
    2020-12-01 00:28

    If you use ng > 1.2, here is an example of using ng-repeat-start/end without generating unnecessary tags:

    
      
        
        
      
      
        
    {{elem.k}} {{elem.v[0]}}
    {{v}}

    The important point: for tags used for ng-repeat-start and ng-repeat-end set ng-if="0", to let not be inserted in the page. In this way the inner content will be handled exactly as it is in knockoutjs (using commands in ), and there will be no garbage.

提交回复
热议问题