Skip to content

Instantly share code, notes, and snippets.

@fireflysemantics
Created December 17, 2019 01:06
Show Gist options
  • Save fireflysemantics/5112e11206f1ca75905d6f7e2d190b63 to your computer and use it in GitHub Desktop.
Save fireflysemantics/5112e11206f1ca75905d6f7e2d190b63 to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core'
import { FormControl } from '@angular/forms'
import { StateService } from './state.service'
import { ACTIVE_MENU_KEY, MENU_ITEMS, MENU_ITEM_VALUES } from './model'
@Component({
selector: 'fs-menu',
template: `
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button *ngFor="let menu of menus"
(click)="onMenuClick(menu)" mat-menu-item
[innerHtml]="menu"></button>
</mat-menu>
`
})
export class FSMenu {
constructor(public ss:StateService) {}
menus:string[] = MENU_ITEM_VALUES()
onMenuClick(menu:string) {
this.ss.ostore.put(ACTIVE_MENU_KEY, menu)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment