Angular PrimeNG Breadcrumb Component
Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the Breadcrumb component in Angular PrimeNG. We will also learn about the properties, events & styling along with their syntaxes that will be used in the code.
Breadcrumb component: It provides the navigation link that is used to link the previous pages the user navigate through & display it in the hierarchy.
- model: It is an array of menuitems to be shown. It is of array data type, the default value is null.
- home: It is the menuItem configuration for the home icon. It is of MenuItem type, the default value is null.
- style: It is the inline style of the component. It is of string data type, the default value is null.
- styleClass: It is the style class of the component. It is of string data type, the default value is null.
- onItemClick: It is a callback that is fired when an item is selected.
- p-breadcrumb: It is the container element.
- p-menuitem: It is the menuitem element.
- p-menuitem-text: It is the label of a menuitem.
- p-breadcrumb-chevron: It is the chevron element.
Creating Angular application & module installation:
- Step 1: Create an Angular application using the following command.
ng new appname
- Step 2: After creating your project folder i.e. appname, move to it using the following command.
- Step 3: Install PrimeNG in your given directory.
npm install primeng --save npm install primeicons --save
Project Structure: It will look like the following:
Example 1: This is the basic example that illustrates how to use the Breadcrumb Component.
Example 2: In this example, we will know how to use home property in the breadcrumb component and also made the elements itemlist using an HTML template.