Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { map, takeWhile } from 'rxjs/operators';
- import { Observable } from 'rxjs';
- import { ObservableInput } from 'observable-input/lib';
- import { Component, EventEmitter, Inject, Input, LOCALE_ID, Output } from '@angular/core';
- import { ListItem } from '@gat/components';
- @Component({
- selector: 'gat-suggestion-patient',
- templateUrl: './suggestion-patient.component.html',
- styleUrls: ['./suggestion-patient.component.scss'],
- })
- export class SuggestionPatientComponent {
- @Output() onSelectedPatient = new EventEmitter<ListItem>();
- @Input() @ObservableInput()
- patientList: Observable<any>;
- listItems$: Observable<any>;
- constructor(
- @Inject(LOCALE_ID) private locale: string | any,
- ) {
- this.listItems$ = this.patientList.pipe(map(this.toListItem));
- }
- toListItem(patient) {
- if (patient) {
- return patient.map(p => {
- return {
- id: p.id,
- title: p.firstName + ' ' + p.lastName,
- body: p.dob,
- //FIXME this.locale is undefined !
- // body: p.dob ? formatDate(p.dob, 'yyyy-MM-dd', this.locale) : '',
- avatar: p.avatar,
- isAvatar: true
- };
- });
- }
- }
- }
Add Comment
Please, Sign In to add comment