File

src/app/modules/search/search.component.ts

Description

Компонент-оболочка для поиска

Implements

OnInit

Metadata

styleUrls search.scss
templateUrl ./search.html

Index

Properties
Methods

Constructor

constructor(route: ActivatedRoute, profileService: ProfileService, settingsService: SettingsService)

Конструктор

Parameters :
Name Type Description
route ActivatedRoute
profileService ProfileService
settingsService SettingsService

Methods

ngOnInit
ngOnInit()

Подгружаем нужное меню

Returns : void

Properties

menu
menu: any
Type : any

Меню

mode
mode: string
Type : string
Default value : search

Режим работы для меню

profile
profile: any
Type : any

Профиль

role
role: string
Type : string

Роль

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import 'rxjs/add/operator/switchMap';

import { ProfileService } from 'glx.ui/components/kernel/services/profile.service';
import { SettingsService } from 'glx.ui/components/kernel/services/settings.service';

import { MENU } from './menu';

/**
 * Компонент-оболочка для поиска
 */
@Component({
  templateUrl: './search.html',
  styleUrls: ['./search.scss']
})
export class SearchComponent implements OnInit {
  /**
   * Меню
   * @type {Array}
   */
  menu: any = [];
  /**
   * Режим работы для меню
   * @type {string}
   */
  mode: string = 'search';
  /**
   * Профиль
   */
  profile: any;
  /**
   * Роль
   * @type {string}
   */
  role: string = '';

  /**
   * Конструктор
   * @param {ActivatedRoute} route
   * @param {ProfileService} profileService
   * @param {SettingsService} settingsService
   */
  constructor(private route: ActivatedRoute,
              private profileService: ProfileService,
              private settingsService: SettingsService) {
  }

  /**
   * Подгружаем нужное меню
   */
  ngOnInit() {
    if (this.route.snapshot.paramMap.get('mode')) {
      this.mode = this.route.snapshot.paramMap.get('mode');
    }
    this.menu = MENU[this.mode];

    this.settingsService.getSection('common')
      .subscribe(
        data => {
          this.menu = data.searchMenu[this.mode];
        },
        error => {
          console.error(error);
        });
  }
}
<glx-top-menu-bx [items]="menu"></glx-top-menu-bx>
<div class="container-fluid">
  <router-outlet></router-outlet>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""