Fala Rafael, tudo bem?
Segue exemplo espero que ajude.
//app.component.html
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { Component } from '@angular/core';
import { Router, RouterOutlet } from '@angular/router';
import {
PoComponentsModule,
PoMenuItem,
PoMenuModule,
PoModule,
PoPageModule,
PoToolbarModule,
} from '@po-ui/ng-components';
import { PoTemplatesModule } from '@po-ui/ng-templates';
import { ProspectListComponent } from './feature/prospect-list/prospect-list.component';
@Component({
selector: 'app-root',
standalone: true,
imports: [
CommonModule,
RouterOutlet,
PoToolbarModule,
PoMenuModule,
PoPageModule,
HttpClientModule,
PoModule,
PoTemplatesModule,
PoComponentsModule,
ProspectListComponent,
],
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
constructor(private router: Router) {}
readonly menus: Array<PoMenuItem> = [
{
label: 'Home',
action: this.onClick.bind(this),
icon: 'po-icon po-icon-money',
shortLabel: 'Home',
},
{
label: 'Prospect',
action: () => this.router.navigate(['/prospect']),
icon: 'po-icon po-icon-money',
shortLabel: 'Prospect',
},
];
private onClick() {
alert('Clicked in menu item');
}
}
//app.routes.ts
import { Routes } from '@angular/router';
import { ProspectListComponent } from './feature/prospect-list/prospect-list.component';
export const routes: Routes = [
{ path: 'prospect', component: ProspectListComponent },
];
//app.component.ts
export class AppComponent {
constructor(private router: Router) {}
readonly menus: Array<PoMenuItem> = [
{
label: 'Home',
action: this.onClick.bind(this),
icon: 'po-icon po-icon-money',
shortLabel: 'Home',
},
{
label: 'Prospect',
action: () => this.router.navigate(['/prospect']),
icon: 'po-icon po-icon-money',
shortLabel: 'Prospect',
},
];
private onClick() {
alert('Clicked in menu item');
}
}