input要素に以下の属性を設定する。
- readonly
- onfocus="this.removeAttribute('readonly');"
- autocomplete="off"
<mat-card class="login-panel">
<mat-card-header>
<mat-card-title>ログイン</mat-card-title>
</mat-card-header>
<mat-card-content>
<form class="login-form">
<mat-form-field class="login-fields">
<input matInput [formControl]="username" placeholder="メールアドレス" type="email" required>
</mat-form-field>
<mat-form-field class="login-fields">
<input matInput [formControl]="password" placeholder="パスワード" type="password" required readonly onfocus="this.removeAttribute('readonly');" autocomplete="off">
</mat-form-field>
</form>
</mat-card-content>
<mat-card-actions align="center">
<button (click)="loginUser()" mat-raised-button color="primary">ログイン</button>
</mat-card-actions>
</mat-card>