DEV Community

Discussion on: Create a Simple Breadcrumb in Angular

Collapse
 
zhiyueyi profile image
Zhiyue Yi

The buildBreadCrumb in the constructor is the initial build for breadcrumb when the application is loaded.

The buildBreadCrumb in onInit is actually in a subscription to a router change. It means that the breadcrumb is always re-built when there is a router change. Because if some modules are lazy loaded, you wouldn't have their routes in the beginning.

Hope that clarifies :)