有没有办法为 angular 表单禁用 chrome AUTOFILL 和 AUTOCOMPLETE?

Is there a way to disable chrome AUTOFILL and AUTOCOMPLETE for angular form?

我想禁用自动填充和自动完成 google chrome 选项 我尝试了变体解决方案,例如:

有什么解决办法吗?

我找到了解决方案:

1 - 将 input type="text" 设置为只读:

<input type="text" [readonly]="inputText" />

2 - 将输入类型密码设置为键入文本并将 css 更改为看起来像密码输入:

html :

<input type="text" [readonly]="inputPassword" class="pw-field"/>

css :

.pw-field{
        -webkit-text-security: disc;
 }

3- 将 focusEvent 添加到两个输入:

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;
    }
}