FarmMapsLib/projects/common/src/fm/components/menu-background/menu-background.component.ts
Peter Bastiani 84a1a04b19
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
AW-6046 Angular improvement
2024-04-15 10:29:47 +02:00

24 lines
773 B
TypeScript

import { Component, Input, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import * as commonActions from '../../actions/app-common.actions';
import * as appReducers from '../../reducers/app-common.reducer';
@Component({
selector: 'fm-menu-background',
templateUrl: './menu-background.component.html',
styleUrls: ['./menu-background.component.scss'],
})
export class MenuBackgroundComponent implements OnInit {
@Input() visible = false;
constructor(private store: Store<appReducers.State>) { }
ngOnInit() { }
handleOnClick(event:MouseEvent) {
if(this.visible) {
this.store.dispatch(new commonActions.SetMenuVisible(false));
event.stopPropagation();
}
}
}