<ion-content>
<ion-title>Text Area Test</ion-title>
<ion-item>
<ion-textarea [(ngModel)]="someAutoFormattedInput" (ionChange)="onAutoFormatChanged()"></ion-textarea>
</ion-item>
</ion-content>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-textarea-test',
templateUrl: './textarea-test.page.html',
styleUrls: ['./textarea-test.page.scss'],
})
export class TextareaTestPage implements OnInit {
someAutoFormattedInput: string;
constructor() { }
ngOnInit() {
}
onAutoFormatChanged() {
this.someAutoFormattedInput = this.setFirstLetterToUppercase(this.someAutoFormattedInput);
}
private setFirstLetterToUppercase(string:string):string {
// https://dzone.com/articles/how-to-capitalize-the-first-letter-of-a-string-in
return string.charAt(0).toUpperCase() + string.slice(1);
}
}