I have this code:
menu.component.ts
export class menuComponent {
menu: object;
state: boolean;
constructor() {
this.state = false;
this.menu = [
item: {
action: this.action
}
]
}
action(): void {
this.state = !this.state;
}
}
menu.component.html
<ul *ngFor="let item of menu">
<li>
<a (click)="item.action()"></a>
</li>
</ul>
what i need is to use the class functions and attributes inside action function, for example state attribute.