如果输入包含整数,则ngx-chips不列出

时间:2018-06-11 15:29:59

标签: angular ngx-chips

我在Angular 4中使用ngx-chips,如果所有输入都是字符串,它工作正常。 如果我在任何输入中输入任何整数,例如mh1,则不会显示下拉列表。

这是我的组件代码:

self::

我的HTML代码:

public requestAutocompleteItems = (text: any): Observable<Response> => {
    let api_base_url = environment.api_end_point+'?json=1&entity=ttp&action=fetchteacherlist&api_key='+environment.default_api_key+'&key='+environment.key+'';
    const url = api_base_url;
    return this.http
      .post(url, '{"teacher_code" : "'+text+'", "entity_id" : "'+localStorage.getItem('my_aol_entity_id')+'", "ttp_lead_id" : "'+localStorage.getItem('my_aol_ttp_lead_id')+'", "source" : "1"}')
      .map(data => data.json().result.map(item => item));
  }

Api回应:

<tag-input name="p_teacher_id" id="p_teacher_id" [ngClass]="'tag-select'" theme='bootstrap' [(ngModel)]="p_teacher_name"
    [placeholder]="'Teacher Code'" [onTextChangeDebounce]="500" [secondaryPlaceholder]="'Teacher Code'" [onlyFromAutocomplete]="true"
    [maxItems]="1" (onAdd)="onSelectedTeacher($event,1)" (onRemove)="onItemRemoved($event,1)">
    <tag-input-dropdown [autocompleteObservable]="requestAutocompleteItems">
        <ng-template let-item="item" let-index="index">
            {{ item.display }}
        </ng-template>
    </tag-input-dropdown>
</tag-input>

0 个答案:

没有答案