【发布时间】:2016-02-26 19:44:37
【问题描述】:
我在使用 ng-show 和 $pristine 时遇到了一些问题。
这里是代码(also on CodePen):
<blockquote ng-show="!comment.author.$pristine && !comment.rating.$pristine && !comment.comment.$pristine">
<p>{{comment.rating}} Stars</p>
<p>{{comment.comment}}</p>
<footer>{{comment.author}}
</blockqoute>
当表单上的每个字段都填满后,我想显示包含我的重复项的 div,但我希望它在一些仍然为空时隐藏。
我尝试使用
!comment.[index].$pristine && ....
所以当每个字段都被填满时,块引用会变得可见,但它不起作用。
【问题讨论】:
标签: javascript angularjs ng-show angularjs-ng-show