Hi,
Yes, you can do this
<form #form="ngForm" (ngSubmit)="onSubmit()">
<jqxEditor
#editor
[width]="'600px'"
[height]="'200px'"
[(ngModel)]="content"
name="content"
required>
</jqxEditor>
<div *ngIf="!content && form.submitted" style="color:red;">
Content is required
</div>
<button type="submit">Submit</button>
</form>
and
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
content = '';
onSubmit() {
if (!this.content) {
console.log('Validation failed: content is empty');
} else {
console.log('Form submitted with:', this.content);
}
}
}
make sure to import the Editor like this:
import { jqxEditorModule } from 'jqwidgets-ng/jqxeditor';
Best regards,
Peter Stoev
jQWidgets Team
https://www.jqwidgets.com/