ANGULARJS2 ng2 Password Hidden display

Source: Internet
Author: User

Code in conjunction with IONIC2 Development Mobile Project, the password of the registration page input is generally used password,

However, when the user enters the password, it may enter an error and need to be displayed as text.

First, the type of the input box is judged;

1 <  type= "{{pwshow? ') Text ': ' Password '}} "  placeholder=" Enter password "></ion-input>

Then, add eye Click event, Ngclass judging icon style;

1 <ahref= "javascript:;"item-end (click)= "Pwshow=!pwshow"[Ngclass]= "Pwshow?" Eyeshow ': ' Eyehide ' ">2    <Ion-iconname= "Ios-eye-off"Color= "Dark"class= "Eye-hide"></Ion-icon> <!-- Close-up icons--3    <Ion-iconname= "Ios-eye"Color= "Dark"class= "Eye-show"></Ion-icon> <!--open-Eyes icon --4 </a>

Finally, attach the Ngclass style, the icon of the hidden display.

1 . Eyehide. Eye-hide,. eyeshow. Eye-show {2   display: block;  3}4. Eyehidee. Eye-show,. Eyeshow. eye-hide{5   display:  None; 6}

The following is attached haha.

Initial state

After opening the eyes

ANGULARJS2 ng2 Password Hidden display

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.