I found a solution :
1 - set input type="text" to readonly :
<input type="text" [readonly]="inputText" />
2 - set input type password to type text and change css to looks like a password input :
html :
<input type="text" [readonly]="inputPassword" class="pw-field"/>
css :
.pw-field{
-webkit-text-security: disc;
}
3- Add a focusEvent to both inputs:
html:
<input type="text" [readonly]="inputText" (focus)='focusFunction("text")' />
<input type="text" [readonly]="inputPassword" class="pw-field" (focus)='focusFunction("pw")' />
ts:
focusFunction(type){
if(type == "text"){
this.inputText = false;
this.inputPassword = true;
}else if(type == "pw"){
this.inputText = false;
this.inputPassword = true;
}
}