采用了棱角分明NG-显示显示DIV [英] Show div using Angular ng-show

查看:330
本文介绍了采用了棱角分明NG-显示显示DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我havings一些问题 NG-节目 $质朴

I'm havings some problems with ng-show and $pristine.

下面是code(也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>

在窗体上的每一个领域已经坐满,我要证明我的包含重复的股利,但我想,有些则仍然是空的它被隐藏。

When every field on the form has been filled, I want to show the div that contains my duplicate, but I want it to be hidden while some are still empty.

我试图用

!comment.[index].$pristine && ....

所以,当每一个领域已经被填满,块引用将成为可见的,但没有奏效。

so when every field has been filled, the blockquote would become visible, but it didn't work.

推荐答案

嘿,你要去的主要问题将是这样,当用户将在最后一个文本框填充任何随机的数据,此刻他充满信股利将是他看到 - 尽管您对code任何改进。

Hey the way you are going the main problem will be that when the user will be filling any random data in the last text box, the moment he fills a letter the div will be visible to him - despite whatever improvements you make to the code.

我会建议是使用 NG-秀=无所谓为您要显示的数据已被填满后,该部分。

What I'll suggest is make use of ng-show="whatever" for that section that you want to show after the data has been filled.

在开始wher控制器开始使假 $ scope.whatever = FALSE; ,现在它不会对用户可见;当用户填好所有的文本框调用一个触发器,并检查数据是否有效,然后 $ scope.whatever = TRUE; - 现在你的部分将是可见的。

In the beginning wher your controller starts make it false $scope.whatever = false; and now it wont be visible to the user; when the user has filled all the text boxes call a trigger and check if the data is valid or not and then $scope.whatever=true; - Now your section will be visible.

要调用触发你可以做各种事情
- 你可以在最后文本框使用 NG-变化并有检查使用他们的具体型号名称文本框的值,我希望你知道这一点。

To call the trigger you can do various things - you can make use of ng-change on the last textbox and there check values of all textboxes using their specific model name, I hope you know that.

让我知道如果你想在这个进一步的澄清。

Let me know if you want further clarification on this.

这篇关于采用了棱角分明NG-显示显示DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆