我有一个3项的数组,并希望它们是“ng-repeated”
<li ng-repeat="item in obj.items id="testobj{{testobj.number}}"> </li>当我查看页面时,似乎“li”的id对于所有3个项目而言只是“testobj”而不是像我期望的那样testobj1 testobj2 testobj3。 有什么问题?
I have an array of 3 items and want them to be "ng-repeated"
<li ng-repeat="item in obj.items id="testobj{{testobj.number}}"> </li>When I look at the page, it appears that the id of the "li" is just "testobj" for all 3 items and not testobj1 testobj2 testobj3 like I was expecting. What is the issue?
最满意答案
您的ng-repeat属性缺少最终的“。
{{}}绑定可能会返回没有数据,因此被视为空字符串。 我看到在绑定之外的任何地方都没有引用testobj (范围变量)。 这是定义的,还是你的id读取id="testobj{{item.number}}"或类似的东西?
Your ng-repeat attribute is missing a final ".
The {{ }} binding is probably coming back with no data and so being treated as if it was an empty string. I see no reference to testobj (the scope variable) anywhere outside of your binding. Is this defined, or should your id read id="testobj{{item.number}}" or something similar?
更多推荐
发布评论