我有两个 ng-repeat 元素,我只想在两个数组元素的文本值匹配时才显示数据。我尝试使用 ng-show 但当值匹配时它不会终止条件。
<div ng-show="activity.id == actor"> found
<span ng-repeat="text in activity.text">
\{{text}}
</span>
</div>
最佳答案
试试这个
<div ng-if="activity.id === 'actor' && propertyFromSecond.ngrepeat ==='actor'">
如果您需要根据情况隐藏或显示信息,请使用 ng-show 如果您确定始终想要渲染满足条件的数据,请使用 ng-if。如果不满足条件,ng-if 内部的元素不会进入 DOM。
关于javascript - 如何在 anular.js View 中比较两个字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36198917/