ng2-breadcrumbs icon indicating copy to clipboard operation
ng2-breadcrumbs copied to clipboard

ExpressionChangedAfterItHasBeenCheckedError

Open TENDesign opened this issue 6 years ago • 0 comments

I am getting an ExpressionChangedAfterItHasBeenCheckedError in my component when using the BreadCrumbService store(); I tried running this on several different lifecycle hooks but all threw the same error.

here is the relevant part of the component.

constructor(
    public contactsrv: ContactsService,
    private router: ActivatedRoute,
    private breadcrumb: BreadcrumbsService
) {
    this.router.params.subscribe(
        params => {
            this.mediaListId = +params['ml'];
            this.contactId = +params['id'];
        }
    );
}

ngOnInit() {

    this.breadcrumb.store([
        {
            label: 'Media Lists',
            url: '/app-media-lists',
            params: []
        },
        {
            label: 'Media List' ,
            url: `/app-media-lists/media-list/list/${this.mediaListId}`,
            params: []
        },
        {
            label: 'Contact Profile',
            url: '',
            params: []
        }
    ]);

    this.getContact();
    this.getTimeline();
    this.getNotes();
    this.getFunnel();
    this.getFunnelCodeTable();

}

the breadcrumb itself is called in the app.component.html:

<ng-progress></ng-progress>
<app-navbar *ngIf="ui" (showEvent)="getToggle($event)"></app-navbar>
<app-sidebar *ngIf="ui" class="main" [ngClass]="{show: show}"></app-sidebar>
<breadcrumb *ngIf="ui" [allowBootstrap]="true"></breadcrumb>
<app-pitching-modal></app-pitching-modal>
<router-outlet></router-outlet>

and in the app.component.ts I have:

ngOnInit() {

    this.breadcrumbs.storePrefixed({label: 'Home' , url: '/', params: []});

    if (screen.width >= 768) {
        this.show = true;
        return this.show;
    } else {
        this.show = false;
        return this.show;
    }

}

TENDesign avatar May 01 '18 15:05 TENDesign