ngqp icon indicating copy to clipboard operation
ngqp copied to clipboard

Support all base value accessors

Open Airblader opened this issue 6 years ago • 5 comments
trafficstars

The missing ones are currently:

  • [x] NumberValueAccessor (can just exend the default accessor and override the change function)
  • [x] RangeValueAccessor (can just extend the default accessor and override the writeValue function)
  • [x] CheckboxValueAccessor
  • [ ] RadioControlValueAccessor
  • [x] SelectMultipleControlValueAccessor (only meaningful once #5 is implemented)

The radio one is a bit tricky since here we will have multiple form controls with the same queryParamName. This means we need to properly support using the same name on multiple controls.

(Edit: which should now work)

Airblader avatar Dec 14 '18 15:12 Airblader

https://github.com/MrWolfZ/ngrx-forms/tree/master/src/view-adapter also implements custom accessors and is a good reference, though we mostly align with angular's implementation.

Airblader avatar Dec 16 '18 17:12 Airblader

Greetings!

Are Radios still unsupported?

verfault avatar Feb 18 '21 16:02 verfault

At the moment, yes, though of course this can be implemented outside of ngqp as well. I would think for the most part and implementation like Angular's can be more or less copied, change the selector for it and it should (hopefully) work.

Airblader avatar Feb 18 '21 16:02 Airblader

A workaround is also to use a regular FormControl for the radio and manually wire it up with ngqp.

Airblader avatar Feb 18 '21 16:02 Airblader

Oh, also note this only affects "vanilla" HTML radio buttons. If you're using some component library like Material, it'll already have a ControlValueAccessor and should work fine.

Airblader avatar Feb 18 '21 20:02 Airblader