less than 1 minute read

Use div contenteditable property with template model binding

If you have div with contenteditable property and you want to bind data model with it, it does not work in angular. While you can edit the div, but the model is not binded/updated.

Solution:

You have to implment ControlValueAccessor. To make things easier, just use this package: ng-contenteditable

Solution found here: how-to-use-ngmodel-on-divs-contenteditable-in-angular2

Leave a comment