Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can´t include breadcrumb in feature module #10

Open
dominikampletzer opened this issue Nov 27, 2017 · 2 comments
Open

Can´t include breadcrumb in feature module #10

dominikampletzer opened this issue Nov 27, 2017 · 2 comments

Comments

@dominikampletzer
Copy link

I try to include the breadcrumb in a feature module. not in the root/app module.

if i import BreadcrumbsModule and use it as discribed
<breadcrumb [allowBootstrap]="true"></breadcrumb> in my headerModule
i get the Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.

But BrowserModule is only imported in my Root/App module. the feature module - headerModule- imports Common Module

app.module.ts
`import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {AppRoutingModule} from "./app-routing.module";
import {NgbModule} from "@ng-bootstrap/ng-bootstrap";
import 'bootstrap/dist/css/bootstrap.min.css';

@NgModule({
imports: [
AppRoutingModule,
BrowserModule,
NgbModule.forRoot(),
],

declarations: [
    AppComponent,
],
providers: [],
bootstrap: [
    AppComponent,
],

})
export class AppModule {
}
`

header.module.ts
`import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {HeaderRoutingModule} from "./header-routing.module";
import {HeaderComponent} from "./header.component";
import {BreadcrumbsModule} from "ng2-breadcrumbs";

@NgModule({
imports: [
CommonModule,
HeaderRoutingModule,
BreadcrumbsModule
],
declarations: [
HeaderComponent,
],
exports: [
HeaderComponent,
],

})
export class HeaderModule {
}
header.component.tsimport {Component} from '@angular/core';
@component({
selector: 'pp-header',
template: <div class="header-container"> <div class="breadCrumb"> <breadcrumb [allowBootstrap]="true"></breadcrumb> </div> </div>,
styleUrls: [String('../../styles.css'), String('./header.css')]
})

export class HeaderComponent {}
`

@crissty
Copy link

crissty commented Oct 15, 2018

Any solution for this behavior? I am in the same situation.

@SGissubel
Copy link

This still doesn't work -- now with ng6-breadcrumb. Cannot import into any module besides app.module it would seem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants