Skip to content

Commit c7dd2ac

Browse files
westerncjanjmao
authored andcommitted
feat: added autocorrect and autocapitalize inputs (#1017)
closes #994
1 parent e3501bd commit c7dd2ac

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ map: {
150150
| [typeahead] | `Subject` | `-` | no | Custom autocomplete or advanced filter. |
151151
| typeToSearchText | `string` | `Type to search` | no | Set custom text when using Typeahead |
152152
| [virtualScroll] | `boolean` | false | no | Enable virtual scroll for better performance when rendering a lot of data |
153+
| autoCorrect | `string` | `off` | no | Allows control of the `autocorrect` attribute. |
154+
| autoCapitalize | `string` | `off` | no | Allows control of the `autocapitalize` attribute. |
153155

154156
### Outputs
155157

src/ng-select/ng-select.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
[attr.autocomplete]="labelForId ? 'off' : dropdownId"
2828
[attr.id]="labelForId"
2929
[attr.tabindex]="tabIndex"
30+
[attr.autocorrect]="autoCorrect"
31+
[attr.autocapitalize]="autoCapitalize"
3032
[readOnly]="!searchable"
3133
[disabled]="disabled"
3234
[value]="filterValue ? filterValue : ''"

src/ng-select/ng-select.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ import { NgSelectConfig } from './config.service';
5252

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

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

107109
@Input() labelForId = null;
110+
@Input() autoCorrect: AutoCorrect = 'off';
111+
@Input() autoCapitalize: AutoCapitalize = 'off';
108112
@Input() @HostBinding('class.ng-select-typeahead') typeahead: Subject<string>;
109113
@Input() @HostBinding('class.ng-select-multiple') multiple = false;
110114
@Input() @HostBinding('class.ng-select-taggable') addTag: boolean | AddTagFn = false;

0 commit comments

Comments
 (0)