AngularJS - 采用NG-重复内NG-秀 [英] AngularJS - using ng-show within ng-repeat
本文介绍了AngularJS - 采用NG-重复内NG-秀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的纳克出现一个 NG-重复中指令块。
I'm having an issue using the ng-show directive within an ng-repeat block.
Boolean值似乎并没有越来越传递到NG-显示正确...
要说明我的意思,这里是一个例子截图我的jsfiddle提出:
To show what I mean, here is a screenshot of an example I made in JSFiddle:
...这里是小提琴本身:<一href=\"http://jsfiddle.net/phillipkregg/zA7QN/6/light/\">http://jsfiddle.net/phillipkregg/zA7QN/6/light/
... and here is the Fiddle itself: http://jsfiddle.net/phillipkregg/zA7QN/6/light/
下面是一些例子标记:
<table ng-controller="BabeController" class="table table-bordered table-striped">
<tr ng-repeat="babe in babeList">
<td>
<span class="babe-name">{{ babe.name }}</span>
<h4 ng-show="{ babe.name == 'Scarlett' }">Was in Avengers! <span class="note">(should only appear if Scarlett)</span></h4>
<h2>{{ babe.name == 'Scarlett'}} <span class="note"><-- this statement is correct</span></h2>
</td>
</tr>
</table>
下面是一个例子控制器:
Here is an example controller:
function BabeController($scope) {
$scope.babeList = [
{
name: "Angelina"
}, {
name: "Scarlett"
}, {
name: 'Mila'
}, {
name: 'Megan'
}
]
}
什么我可以做任何想法错了?
推荐答案
在你的 NG-节目
你不需要{}试试这个:
In your ng-show
you don't need { } try this:
<h4 ng-show="babe.name == 'Scarlett'">Was in Avengers! <span class="note">
请参阅这个提琴一个 NG-节目
内工作示例一个 NG-重复
。
See this fiddle for a working sample of an ng-show
within an ng-repeat
.
这篇关于AngularJS - 采用NG-重复内NG-秀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文