我们刚刚将应用程序升级到angular 7,我们注意到所有ngBootstrap模式现在都有一个默认的关闭按钮自动对焦,如下图所示.
这是我的代码:
html模式代码:
<form [formGroup]="storeForm" novalidate>
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Modal Test</h4>
<button type="button" class="close" aria-label="Close"
(click)="activeModal.dismiss('Cross click')">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<h4>Todo</h4>
</div>
<div class="modal-footer">
<button role="button" type="submit" class="btn btn-primary"
(click)="activeModal.close('Finish click')" prevent-double-
submit>{{ 'store.add.finish' | translate }}</button>
</div>
</div>
</form>
多亏了我的组件,模态是如何命名的.ts
const modal = this._modalService.open(ModalComponent, { backdrop:
'static', size: 'lg'});
modal.result.then(
(data) => {
// some code
},
() => {
}
);
我的问题是,我如何删除这个不符合我们预期行为的默认自动对焦?
感谢阅读,请原谅拼写错误.