드롭 다운 메뉴에서 선택한 옵션에 따라 내용을 TinyMCE 편집기로 동적으로 설정하려고합니다.동적으로 내용을 TinyMCE 편집기로 설정하는 방법
<app-tinymce [elementId]="'myEditor'" [content]="myContentVar"></app-tinymce>
변수 myContentVar
은 드롭 다운 메뉴 선택이 변경 될 때마다 올바르게 업데이트됩니다.
onSelectionChanged(selectedValue: string){
this.myContentVar = selectedValue;
}
그러나 TinyMCE 편집기는 항상 공백으로 표시됩니다. {{myContentVar}}
은 올바른 값을 표시합니다.
다음은 TinyMCE의 구성 설정입니다.
tinymce.init({
selector: '#' + this.elementId,
plugins: ['link image code charmap preview anchor'],
toolbar: 'undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent',
setup: editor => {
this.editor = editor;
editor.on('change',() => {
const content = editor.getContent();
this.editorContent = content;
this.onEditorContentChange.emit(content);
this.onModelChange(content);
this.onTouch(content);
if (this._controlContainer) {
if (this.formControlName) {
this.control = this._controlContainer.control.get(this.formControlName);
if (this.control) {
this.control.setValue(new RichFieldTextModel(this.formControlName, this.elementId, this.editorContent));
}
}
}
});
}
});
때 TinyMCE에 초기화 발생합니까를? 언제든지 각도 코드가 오기 전에 (경쟁 조건 또는 주문 문제가 있습니까?) – Fenton