angular-code-input icon indicating copy to clipboard operation
angular-code-input copied to clipboard

Add Option to Auto Capitalize inputs

Open andyrue opened this issue 4 years ago • 3 comments

It would be nice to have an option to auto capitalize inputs as they get typed in. The autocapitalize attribute has been added, but this is only used for virtual keyboards and has limited browser support. A better way would be to handle this inside the component, observing inputs and capitalizing them as they come in.

andyrue avatar Nov 18 '21 20:11 andyrue

@andyrue I guess I will additional setting for the component.

AlexMiniApps avatar Nov 26 '21 15:11 AlexMiniApps

Any update on this? I need my input to be automatically capitalized.

hkaiser25 avatar Apr 12 '24 19:04 hkaiser25

@hkaiser25 Unfortunately I don't have a time to focus on the library. I am planning to complete it but not now. As a temporary solution you can do the following: In HTML: <code-input ... [code]="code" (codeChanged)="onCodeChanged($event)" (codeCompleted)="onCodeCompleted($event)"> </code-input> In the code:

...
  public code = '';
...
  public async onCodeChanged(code: string): Promise<void> {
    this.code = code;
    await new Promise(resolve => setTimeout(resolve, 50));
    this.code = code.toLocaleUpperCase();
  }

  public onCodeCompleted(code: string): void {
    const value = code.toLocaleUpperCase();
    ...
  } 

AlexMiniApps avatar Apr 19 '24 09:04 AlexMiniApps