简体   繁体   English

指令视图内的Angular ng-repeat

[英]Angular ng-repeat inside directive view

I'm trying to do a ng-repeat inside the view returned by a directive. 我正在尝试在指令返回的视图内执行ng-repeat。 Here is my template defined in templateUrl 这是我在templateUrl中定义的模板

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

The content inside "inside" class is empty, while the content at the bottom of outside class is correct. “内部”类内部的内容为空,而外部类底部的内容正确。 What am I missing? 我想念什么? thank you 谢谢

It should be cup in copas for your ngRepeat expression: 对于您的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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM