Reputation: 1
I have 2 modules in my angular 2 app which was created with Angular-Cli. (version 1.0.0-beta.28.3) Packages are installed by 'npm install ng2-bootstrap@latest bootstrap@latest --save' ( not sure if I miss something ) ng2-bootstrap and bootstrap packages are latest versions. When I import ng2-directive in app.module.ts, everything is working fine. However, I try to use it in nested module, nothing is appear.
Clearly saying:
import { InModule } from './in.module';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AccordionModule } from 'ng2-bootstrap';
import { AppComponent } from './app.component';
import { CompComponent } from './comp/comp.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
InModule,
HttpModule,
AccordionModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
I can use accordions on appcomponent. However, when I try to use it as the following in CompComponent:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AlertModule } from 'ng2-bootstrap';
import { CompComponent } from './comp/comp.component';
@NgModule({
declarations: [
CompComponent
],
imports: [
BrowserModule,
FormsModule,
AlertModule.forRoot() // or just AlertModule
],
providers: [],
bootstrap: []
})
export class InModule { }
I got white screen.
I'm not sure if its an issue or my mistake.
Upvotes: 0
Views: 729
Reputation: 3124
Have you added bootstrap css to your angular-cli.json. You still have to load the css
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
Upvotes: 0