mpbalmeida / hal-4-angular

HAL for Angular
MIT License
6 stars 2 forks source link

Cannot upload the explicit value null to any field! #12

Open Masterxilo opened 4 years ago

Masterxilo commented 4 years ago

Because of this line

https://github.com/mpbalmeida/hal-4-angular/blob/bce59f19716890c8d379ade4fec073d1197e6060/src/resource-helper.ts#L63

it is impossible to submit the value null for a property to the backend. You delete all properties with the value null!

Please consider not filtering out this value. It must be possible to reset database columns to null when an empty value is used!

see also https://github.com/masvis/angular4-hal/issues/75

Masterxilo commented 4 years ago

I am privately forking this repository and fixing this for myself for now.

Masterxilo commented 4 years ago

my fix:

if (resource[key] !== undefined) {

if (resource[key] && ResourceHelper.className(resource[key])
                    .find(function (className) { return className == 'Resource'; })

else if (resource[key] && Array.isArray(resource[key])) {

the rest is unchanged