What is this library?
This is micro Angular v6+ contenteditable directive for compatibility with Angular forms. It just implements ControlValueAccessor for this purpose.
Install
npm install @ng-stack/contenteditable --save
Usage
Import and add ContenteditableModule
to your project:
;; // ...
And then you can to use it in template-driven forms or reactive forms like this:
// In your component;;
{{ testForm.value | json }} {{ myControl.value | json }}
Options
With contenteditable
directive you can pass optional @Input
value for propValueAccessor
:
In ContenteditableDirective
this value use like this:
this.elementRef.nativeElement
By default it using textContent
.
contenteditable
as @Input property
Since version 1.0.0, @ng-stack/contenteditable
accepts contenteditable
as @Input property (note the square brackets):
where isContenteditable
is a boolean variable.