rajaramtt / ng7-dynamic-breadcrumb

Angular 10 Dynamic Breadcrumbs
MIT License
42 stars 31 forks source link

[BUG] Breadcrumb.map is not a function #9

Closed r-hannuschka closed 3 years ago

r-hannuschka commented 5 years ago

By default i simple installed the npm module without define any breadcrumbs, but this leads to an error:

image

This is thrown in BreadCrumbComponent:75

Simple to reproduce, dont add any breadcrumbs, this will call update data with newBreadCrumb as null and null.map is not working, but as i see this, why call updateData with null as second parameter if this is the expected new Bread Crumb ? breadcrumb.component.ts:67

Yes i know i have to define some breadcrumbs to get a better result, but i think it should not crash just because i dont have registered Breadcrumbs.

r-hannuschka commented 5 years ago

Well sry my mistake, i had an other breadcrumb module before, so breadcrumb was not an object it was a string and yes string.map will not work :D

But i think it should approve this before and not crash.

rajaramtt commented 5 years ago

@r-hannuschka If possible Please create stackblitz example link!.

dealenx commented 4 years ago

I had the same error, I had a routing:

....
data: {
      breadcrumb: "My Page"
    }
....

The problem was resolved after this fix:

....
data: {
      title: "My Page",
      breadcrumb: [
        {
          label: "My Page",
          url: ""
        }
      ]
    }
....
rajaramtt commented 3 years ago

The issue has been fixed no need for resolution