-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typeahead): Added form support (#723)
- Loading branch information
Showing
3 changed files
with
58 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,43 @@ | ||
<div class='container-fluid'> | ||
<h4>Static arrays</h4> | ||
<pre class="card card-block card-header">Model: {{selected | json}}</pre> | ||
<input [(ngModel)]="selected" | ||
[typeahead]="states" | ||
(typeaheadOnSelect)="typeaheadOnSelect($event)" | ||
class="form-control"> | ||
<!-- Static arrays --> | ||
<h4>Static arrays</h4> | ||
<pre class="card card-block card-header">Model: {{selected | json}}</pre> | ||
<input [(ngModel)]="selected" | ||
[typeahead]="states" | ||
(typeaheadOnSelect)="typeaheadOnSelect($event)" | ||
class="form-control"> | ||
|
||
<!-- Asynchronous results --> | ||
<h4>Asynchronous results</h4> | ||
<pre class="card card-block card-header">Model: {{asyncSelected | json}}</pre> | ||
<input [(ngModel)]="asyncSelected" | ||
[typeahead]="dataSource" | ||
(typeaheadLoading)="changeTypeaheadLoading($event)" | ||
(typeaheadNoResults)="changeTypeaheadNoResults($event)" | ||
(typeaheadOnSelect)="typeaheadOnSelect($event)" | ||
[typeaheadOptionsLimit]="7" | ||
[typeaheadOptionField]="'name'" | ||
placeholder="Locations loaded with timeout" | ||
class="form-control"> | ||
<div *ngIf="typeaheadLoading===true"> | ||
<i class="glyphicon glyphicon-refresh ng-hide" style=""></i> | ||
</div> | ||
<div *ngIf="typeaheadNoResults===true" class="" style=""> | ||
<i class="glyphicon glyphicon-remove"></i> No Results Found | ||
</div> | ||
|
||
<h4>Asynchronous results</h4> | ||
<pre class="card card-block card-header">Model: {{asyncSelected | json}}</pre> | ||
<input [(ngModel)]="asyncSelected" | ||
[typeahead]="dataSource" | ||
(typeaheadLoading)="changeTypeaheadLoading($event)" | ||
(typeaheadNoResults)="changeTypeaheadNoResults($event)" | ||
<!--Typeahead inside a form--> | ||
<h4>Typeahead inside a form</h4> | ||
<pre class="card card-block card-header">Model: {{myForm.value.state | json}}</pre> | ||
<form [formGroup]="myForm"> | ||
<input formControlName="state" | ||
[typeahead]="states" | ||
(typeaheadOnSelect)="typeaheadOnSelect($event)" | ||
[typeaheadOptionsLimit]="7" | ||
[typeaheadOptionField]="'name'" | ||
placeholder="Locations loaded with timeout" | ||
placeholder="Typeahead inside a form" | ||
class="form-control"> | ||
<div *ngIf="typeaheadLoading===true"> | ||
<i class="glyphicon glyphicon-refresh ng-hide" style=""></i> | ||
</div> | ||
<div *ngIf="typeaheadNoResults===true" class="" style=""> | ||
<i class="glyphicon glyphicon-remove"></i> No Results Found | ||
</div> | ||
</form> | ||
|
||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters