Skip to content

Commit

Permalink
feat: added autocorrect and autocapitalize inputs (#1017)
Browse files Browse the repository at this point in the history
closes #994
  • Loading branch information
westerncj authored and anjmao committed Jan 15, 2019
1 parent e3501bd commit c7dd2ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ map: {
| [typeahead] | `Subject` | `-` | no | Custom autocomplete or advanced filter. |
| typeToSearchText | `string` | `Type to search` | no | Set custom text when using Typeahead |
| [virtualScroll] | `boolean` | false | no | Enable virtual scroll for better performance when rendering a lot of data |
| autoCorrect | `string` | `off` | no | Allows control of the `autocorrect` attribute. |
| autoCapitalize | `string` | `off` | no | Allows control of the `autocapitalize` attribute. |

### Outputs

Expand Down
2 changes: 2 additions & 0 deletions src/ng-select/ng-select.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
[attr.autocomplete]="labelForId ? 'off' : dropdownId"
[attr.id]="labelForId"
[attr.tabindex]="tabIndex"
[attr.autocorrect]="autoCorrect"
[attr.autocapitalize]="autoCapitalize"
[readOnly]="!searchable"
[disabled]="disabled"
[value]="filterValue ? filterValue : ''"
Expand Down
4 changes: 4 additions & 0 deletions src/ng-select/ng-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import { NgSelectConfig } from './config.service';

export const SELECTION_MODEL_FACTORY = new InjectionToken<SelectionModelFactory>('ng-select-selection-model');
export type DropdownPosition = 'bottom' | 'top' | 'auto';
export type AutoCorrect = 'off' | 'on';
export type AutoCapitalize = 'off' | 'on';
export type AddTagFn = ((term: string) => any | Promise<any>);
export type CompareWithFn = (a: any, b: any) => boolean;

Expand Down Expand Up @@ -105,6 +107,8 @@ export class NgSelectComponent implements OnDestroy, OnChanges, AfterViewInit, C
@Input() clearOnBackspace = true;

@Input() labelForId = null;
@Input() autoCorrect: AutoCorrect = 'off';
@Input() autoCapitalize: AutoCapitalize = 'off';
@Input() @HostBinding('class.ng-select-typeahead') typeahead: Subject<string>;
@Input() @HostBinding('class.ng-select-multiple') multiple = false;
@Input() @HostBinding('class.ng-select-taggable') addTag: boolean | AddTagFn = false;
Expand Down

0 comments on commit c7dd2ac

Please sign in to comment.