I have a comment section which is in form of text area and I want to enable a another button if user start typing some character(except space) into the textarea. How can I do that in angular2?
I already have it working but my problem is that the button gets enabled even if the user enter 'space' in text area. How can I correct this behavior so that only when user writes something the button gets enabled?
in html:
<textarea id="comments"
class="comments-text"
[(ngModel)]="text"
(ngModelChange)="onAddComment($event)"
name="text"></textarea>
<button [disabled]="EnableButton()">
in component:
public onAddComment(event: string): void {
this.passedString = event;
}
public EnableButton(): void {
return !!this.passedString;
}