0
我想從角度2中的ng-bootstrap模塊導入某些特定組件。 我可以這樣做嗎?從角度2中的ng-bootstrap模塊中排除組件2
我有從現有的ng-bootstrap組件創建的自定義標籤集。 導入ng-bootstrap後,我得到模塊重複錯誤。
我該如何處理這個問題。
我想從角度2中的ng-bootstrap模塊導入某些特定組件。 我可以這樣做嗎?從角度2中的ng-bootstrap模塊中排除組件2
我有從現有的ng-bootstrap組件創建的自定義標籤集。 導入ng-bootstrap後,我得到模塊重複錯誤。
我該如何處理這個問題。
很容易:只需從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 {}
當然,你將不得不進口,並列出您正在使用,但這裏的好處是,你可以精確地只引用一些事情的所有模塊用於您的應用程序。