我在惰性模块中导入了 ng-bootstrap 的模态库。
@NgModule({imports: [NgbModalModule]})
该库NgbModal
在 root 中提供了一项服务。
@Injectable({providedIn: 'root'})
class NgbModal {...}
我将它注入到一个组件中。
constructor(private modal: NgbModal) {}
我开发了一个类扩展。
export class CustomNgbModal extends NgbModal{...}
如何使用 CustomNgbModal 覆盖 NgbModal 类型?
使用模块将是
{provide: NgbModal, useClass: CustomNgbModal}
但是使用提供的根元数据,没有线索。
那么,如何覆盖根目录中提供的模块?