2017-11-30 5 views
0

ng-bootstrapのNgbTypeaheadコンポーネントを使用しています。私はフォーカスがすでにある間に入力ボックスをクリックするとドロップダウンが閉じられるという問題に直面しています。これは、ドロップダウンを開きます入力ボックスに http://plnkr.co/edit/rxOhDy72YWlLy9U4Ujcd?p=preview入力ボックスに再フォーカスするとドロップダウンが閉じます

  1. タイプアル、入力ボックスに
  2. クリック:ここで

    <input id="typeahead-template" type="text" class="form-control" 
        [(ngModel)]="model" [ngbTypeahead]="search" [resultTemplate]="rt" 
        [inputFormatter]="formatter" /> 
    

    は、問題を再現する手順とplunkerな結果ドロップダウンを閉じる際に

入力ボックス内をクリックし続けることはできますが、ドロップダウンは閉じたままです。追加の単語を入力すると表示されます。

+0

確かに、これは私たちの実装で問題だったとちょうどリリースされたhttps://github.com/ng-bootstrap/ng-bootstrap/releases/tag/1.0.0-beta.6で修正されました –

答えて

0

おそらく動作がNgbTypeahead自体に起因するため、入力が閉じられます。ただし、これは、クリックイベントをバインドし、入力に対してstopPropagationを実行すると解決できます。

のsrc /先行入力-template.html

<input id="typeahead-template" type="text" class="form-control" 
    [(ngModel)]="model" [ngbTypeahead]="search" [resultTemplate]="rt" 
    [inputFormatter]="formatter" (click)="onClick($event)" /> 

のsrc /先行入力-template.ts

onClick(event) { 
    event.stopPropagation(); 
} 

http://plnkr.co/edit/KSXmKOSPCv6OuE6OmzgA?p=preview

関連する問題