Bootstrap ngb字头在Angle 7中不起作用

时间:2019-05-23 11:28:18

标签: javascript angular typescript ng-bootstrap

我最近将我的角度4.4升级到角度7 而且我遇到了多个错误,但是现在我已经实现了一个ngb字体,它在角度4上可以正常工作,但是当我单击它时它没有打开/显示 有人可以找出问题所在吗?

html组件

 <div class="input-group">
      <span class="material-icons search"
            [ngClass]="{'search-focus': searchFocused}">search</span>
      <input (click)="triggerTypeahead($event);" (focus)="searchFocused"
             (blur)="searchFocused = false;" type="text" name="provider"
             class="form-control input-underline input-lg typeahead-input" id="provider"
             required [(ngModel)]="testOrder.PatientName"
             aria-describedby="basic-addon1" placeholder="Search Patient*"
             [ngbTypeahead]="patientSearch" [resultFormatter]="formatPatient"
             [resultTemplate]="dropdownTemplate" (selectItem)="onPatientSelect($event)">
    </div>

下拉模板

<ng-template #dropdownTemplate let-result="result" let-term="term" let-formatter="formatter">
<span *ngIf="result.Id">
<div>{{result.FirstName}} {{result.LastName}}</div>
      <div class="text-dimmed">
        <small>DOB: {{ result.Dob | date:'MM/dd/y' }}</small>
      </div>
</span>
 <span *ngIf="showCreatePatientOption" (click)="onClickNewPatient()">
Create New Patient
<b class="create-plus"> + </b>
</span>
</ng-template>

Ts文件

public searchFocused = true;

patientSearch = (text$: Observable<string>) => {

 return text$.pipe(
   mergeMap(term => {
     return this.patientService.getPatients(
      {
        Sort: '',
        Order: '',
        SearchTerm: term,
        PageNumber: 1
      }
    );
  }),
  map(patients => patients.slice(0, patients.length)),
  map(patients => {
    patients.map(elem => {
      return elem.Dob;
    });

    this.showCreatePatientOption = patients.length === 0;

    if (patients.length === 0) {
      patients.push(new Patient());
    }
    return patients;
   }),);
};

triggerTypeahead(e: Event): void {
e.stopPropagation();
setTimeout(() => {
  const inputEvent: Event = new Event("input");
  e.target.dispatchEvent(inputEvent);
  }, 0);
}

预期结果是,当我单击输入字段时,它会打开带有患者姓名的打印头 但是现在它确实打开了 我缺少什么吗? 谢谢

0 个答案:

没有答案