What is # in ion input


#1

Hi !

What is the interest of the # name in this example please ? <ion-input #inputPass>


#2

may be it is used as ngModel for element.


#3

@Quiesan That would make a variable representing your input that can be accessed in the template (Example: <some-component (tap)="inputPass.someMethod()">), and you also can use it to see your component with ViewChild in your ts file:

@ViewChild('inputPass') myInput: TextInput;

private someMethod() {
    this.myInput.someMethod();
}

You can see more about it here: https://angular.io/guide/template-syntax#ref-vars


#4

Thank you very much !:slight_smile: