I use Primeng version 11 for my Angular 11 project. I am creating a panel menu using primeng and I want to change the p-panelmenu-icon to fa-caret-right but I don't know how to change the icon to fa-caret-down when click on a menu item.
Here is my app.component.ts file:
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { MenuItem } from 'primeng/api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
items: MenuItem[] = [];
ngOnInit() {
this.items = [
{
label: 'File',
icon: 'pi pi-pw pi-file',
items: [
{ label: 'Open', icon: 'pi pi-fw pi-external-link' },
{ separator: true },
{ label: 'Quit', icon: 'pi pi-fw pi-times' }
]
},
{
label: 'Edit',
icon: 'pi pi-fw pi-pencil',
items: []
}
];
}
}
My app.component.html file
<p-panelMenu [model]="items" [style]="{ width: '300px',margin:'auto',padding:'2rem' }"></p-panelMenu>
My app.component.css file
:host ::ng-deep .p-panelmenu .p-panelmenu-panel .p-panelmenu-header .p-panelmenu-icon::before {
content: "\f0da"; /*caret-right*/
font-family: "Font Awesome 5 Pro";
font-weight: 900;
font-size: 1rem;
color: #ff9900;
}