V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
AlanZhang
V2EX  ›  Angular

ng-repeat 用了多个$index, 怎样定位不同的$index?

  •  
  •   AlanZhang · 2014-12-12 11:04:41 +08:00 · 9250 次点击
    这是一个创建于 3394 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ng-repeat="certification in product.certifications track by $index"
    ng-repeat="standards in certification.standards track by $index"

    这两个$index都需要定位到。
    3 条回复    2014-12-12 11:13:54 +08:00
    L42y
        1
    L42y  
       2014-12-12 11:09:17 +08:00   ❤️ 1
    用 `ngRepeat`: https://docs.angularjs.org/api/ng/directive/ngInit

    The only appropriate use of ngInit is for aliasing special properties of ngRepeat
    L42y
        2
    L42y  
       2014-12-12 11:09:50 +08:00   ❤️ 1
    不好意思,应该是用 ngInit
    AlanZhang
        3
    AlanZhang  
    OP
       2014-12-12 11:13:54 +08:00
    非常感谢。 就是这个。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3924 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:26 · PVG 18:26 · LAX 03:26 · JFK 06:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.