show/hide password text using angular2

后端 未结 8 1341
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 11:53

i want to show/hide the password text based on the user click. But i am getting the following error saying:

export class App {
    password = \"secret\"         


        
8条回答
  •  逝去的感伤
    2021-02-15 12:26

    This is a better answer. Check below:

    input

    
    

    click action

    
    

    component

    // variable
    show: boolean;
    
    constructor() {
       // initialize variable value
       this.show = false;
    }
    
    // click event function toggle
    password() {
        this.show = !this.show;
    }
    

提交回复
热议问题