2017-03-01 79 views

回答

3

很容易:只需從ng-bootstrap導入單個模塊,而不是導入整個NgbModule。例如,只進口警報相關的功能,你會怎麼做:

import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap/alert/alert.module'; 

... 

@NgModule({ 
    imports: [BrowserModule, NgbAlertModule.forRoot()], 
    declarations: [App] 
    bootstrap: [App] 
}) 
export class AppModule {} 

當然,你將不得不進口,並列出您正在使用,但這裏的好處是,你可以精確地只引用一些事情的所有模塊用於您的應用程序。