问题描述
我在 Internet Explorer 上使用 FormControl 时遇到问题,目前我还没有找到可行的解决方案。我有一个输入组件,它使用 FormControl 传递的值呈现。问题是,例如,如果我删除屏幕上输入的内容并刷新页面,则渲染组件时没有内容,在实例化组件时传递给 formControl 的值被忽略。>
我知道如果按 Ctrl + f5 刷新页面会按预期工作,但是我如何防止 Internet Explorer 缓存行为?
这是一个最小的、可重复的示例:
我的输入组件
@Component({
selector: 'app-input-component',template: ` <input type="text" [formControl]="inputControl" autocomplete="off"/> `,})
export class InputComponentComponent implements OnInit {
@input() inputControl: AbstractControl;
constructor() {}
ngOnInit() {}
}
使用我的输入组件的组件
@Component({
selector: 'app-root',template: `<app-input-component [inputControl]="inputControl"></app-input-component>`,})
export class AppComponent implements OnInit {
inputControl = new FormControl('21/09/1999');
constructor() {}
ngOnInit() {}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)