How to use labels inside loops with AngularJS

后端 未结 3 785
陌清茗
陌清茗 2021-02-02 06:01

So I\'m inside an ng-repeat like this:

  • 3条回答
    •  傲寒
      傲寒 (楼主)
      2021-02-02 06:37

      For many scenarios, a better solution might be to enclose both the and label text in a single element. This is perfectly valid HTML, works properly in all browsers, and has the added benefit of being easy to use with hierarchical data, since you don't need to use the iterator variable:

    提交回复
    热议问题