Projekt

Obecné

Profil

Stáhnout (679 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
import { Component, OnInit } from '@angular/core';
2
import { MenuService } from '../services/menu.service';
3
import { MenuItem } from './menu-item';
4

    
5
@Component({
6
  selector: 'app-menu',
7
  templateUrl: './menu.component.html',
8
  styleUrls: ['./menu.component.sass']
9
})
10
export class MenuComponent implements OnInit {
11
  menuItems: MenuItem[];
12
  selectedMenuItem: MenuItem;
13

    
14

    
15
  getMenuItems(): void {
16
    this.menuService.getMenuItems()
17
      .subscribe(menuItems => this.menuItems = menuItems);
18
  }
19

    
20
  onSelect(menuItem: MenuItem): void {
21
    this.selectedMenuItem = menuItem;
22
  }
23

    
24
  constructor(private menuService: MenuService) { }
25

    
26
  ngOnInit() {
27
    this.getMenuItems();
28
  }
29

    
30

    
31
}
(4-4/4)