When using ModalModule.forRoot (), it registers material that is needed only once in the application database. (Appmodule)
Then you can import ModalModule to any place you need it and will use singleton objects created with .foorRoot ().
So, in your case, you should use ModalModule.foorRoot () in the AppModule, then in your general module you must first imports: [ModalModule] , and then exports: [ModalModule] so that it is available everywhere.
Ps. There is a more complete bootstrap project by the same guys who made ui-bootstrap for angular 1: https://ng-bootstrap.imtqy.com
source share