I'm trying to pass a variable commentEdit from viewbook.component.ts to tinymce.component.ts, but it receives a wrong value.
The problem is that "comment" in tinymce.component.ts always receives an empty string ' '.
When I do click on the span, commentEdit gets a new value, but it dont update the value on the other component.
How can I do that?
viewbook.component.ts
...
export class ViewBookComponent implements OnInit {
public commentEdit= '';
public comment='';
...
keyupHandlerFunction(bookComment) {
this.comment = bookComment;
}
openModalEdit(comment) {
this.commentEdit = comment;
}
...
}
viewbook.component.html
...
<span (click)="openModalEdit(comment.comment)" data-toggle="modal"...></span>
...
<tinymce
[elementId]="'edit-comment-book'"
[plugins]="['link', 'paste']"
[comment]='commentEdit'
(onEditorKeyup)="keyupHandlerFunction($event)"
>
</tinymce>
...
tinymce.component.ts
export class TinymceComponent implements AfterViewInit, OnDestroy {
@Input() comment: String;
...
Thanks!
Edit: I have solved it using ngOnChanges() Tinymce Angular 2 integration : how to set the content of the editor?