export class Menu { id: number; name: string; link: string; icon: string; badge: string; parentId: number; parent: Menu; childs: Menu[] = []; isopen: boolean; constructor(menu: Menu = null) { if(menu) { this.id = menu.id; this.name = menu.name; this.link = menu.link; this.icon = menu.icon; this.badge = menu.badge; this.parentId = menu.parentId; } } open() { if(this.parent) this.parent.close(); if(this.parent) this.parent.open(); this.isopen = true; } close() { for(let i = 0;i < this.childs.length;i++) this.childs[i].close(); } }