Closed hasanw07 closed 8 months ago
Hi,
You mixed two concepts together Reactive forms and Template-driven forms. Use Reactive either Template, not both at the same time. I tested it and it works for me with [(ngModel)].
I'm using reactive forms, but it's still cannot load the value. here is my code snippet
ngOnInit():void{ this.testForm = this.fb.group{[ objectives: new FormControl(this.objectives, Validators.nullValidator), ]};
forkJoin({
testData : this.applicationSvc.getObjectives(this.id)
}).subscribe({
next: (data: any) => {
this.objectives = data.testData;
this.testForm.patchValue(this.objectives);
this.courseForm.get("objectives")?.patchValue(this.objectives);
});
}
html
<st-editor formControlName="objectives" [config]="editorConfig"></st-editor>
Hey man, Thanks for the issue, Reactive forms are really broken. The bug fix will be during the weekend in the latest version.
I found bug and I am fixing, but If you need it urgent, you can use something like
setTimeout(() => this.testForm.patchValue(this.objectives))
Released in v4.0.3, versions compatible with older Angular will be released soon.
Also fixed in v1.4.1 v2.0.1 and v3.0.1
I have tried this code but no value appeared in the st-editor.
In my code, the "objective" is calling from api service inside ngOnInit().
<st-editor formControlName="objectives" [(ngModel)]="objectives" [config]="editorConfig" > {{ objectives }}