angulardart / angular

Fast and productive web framework provided by Dart
https://pub.dev/packages/angular
MIT License
1.83k stars 233 forks source link

Not sure If I am correct, I also find it hard to understand on how to correctly implements custom value accessor. #1956

Open bll55020674 opened 3 years ago

bll55020674 commented 3 years ago

Not sure If I am correct, I also find it hard to understand on how to correctly implements custom value accessor.

Did you try to bind NgControl to you ValueAccessor ?

final NgControl ngControl;

ContentEditableDirective(this._element, @Self() @Optional() this.ngControl) {
   ngControl?.valueAccessor = this;
}

void ngOnDestroy() {
  ngControl?.valueAccessor = null;
}

The other possible solution would be to inject you value accessor like it's done for DefaultValueAccessor

Originally posted by @lejard-h in https://github.com/angulardart/angular/issues/1941#issuecomment-748014576

lejard-h commented 3 years ago

@bll55020674 any reason to repost my comments here ?