【问题标题】:Angular ng-repeat inside directive view指令视图内的角度 ng-repeat
【发布时间】:2015-03-09 17:52:33
【问题描述】:

我正在尝试在指令返回的视图中执行 ng-repeat。 这是我在 templateUrl 中定义的模板

<div class="outside">
    <div class"inside" ng-repeat="copas as cup">
        {{ cup.nombre }}
        cupcakes.nombre
        {{ cup }}
        cupcakes
    </div>
    {{ copas[0].nombre }}
    {{ copas }}
</div>

“inside”类里面的内容是空的,而outside类底部的内容是正确的。 我错过了什么? 谢谢你

【问题讨论】:

    标签: javascript angularjs angularjs-directive angularjs-ng-repeat


    【解决方案1】:

    您的 ngRepeat 表达式应该是 cup in copas:

    <div class="outside">
        <div class"inside" ng-repeat="cup in copas">
            {{ cup.nombre }}
            cupcakes.nombre
            {{ cup }}
            cupcakes
        </div>
        {{ copas[0].nombre }}
        {{ copas }}
    </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多