This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
mock-search.component.ts 844 B
Newer Older
import { Component, OnInit } from '@angular/core';
Daniel Rainer's avatar
Daniel Rainer committed
import { SearchResult } from 'app/shared/model/search-result.model';
import { Person } from 'app/shared/model/person.model';
import { MOCK_RESULTS } from './mock-search-results';

@Component({
  selector: 'jhi-mock-search',
  templateUrl: './mock-search.component.html',
  styleUrls: ['./mock-search.scss'],
})
export class MockSearchComponent implements OnInit {
  mockResults = MOCK_RESULTS;
  selectedResult?: SearchResult;

  constructor() {}

  ngOnInit(): void {}

  public get results(): SearchResult[] {
    return this.mockResults;
  }

  public getPersonName(person: Person): string {
    return person.name;
  }

  public arrayToString(array: string[]): string {
    let result = '';
    array.forEach(element => {
      result += element + '<br>';
    });
    return result;
  }