File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
projects/angular2-jsonapi/src/services Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,16 @@ export class JsonApiDatastore {
287
287
data : relationshipData
288
288
} ;
289
289
}
290
+ } else if ( data [ key ] === null ) {
291
+ const entity = belongsToMetadata . find ( ( entity : any ) => entity . propertyName === key ) ;
292
+
293
+ if ( entity ) {
294
+ relationships = relationships || { } ;
295
+
296
+ relationships [ entity . relationship ] = {
297
+ data : null
298
+ } ;
299
+ }
290
300
}
291
301
}
292
302
}
@@ -459,7 +469,7 @@ export class JsonApiDatastore {
459
469
const modelsTypes : any = Reflect . getMetadata ( 'JsonApiDatastoreConfig' , this . constructor ) . models ;
460
470
461
471
for ( const relationship in relationships ) {
462
- if ( relationships . hasOwnProperty ( relationship ) && model . hasOwnProperty ( relationship ) ) {
472
+ if ( relationships . hasOwnProperty ( relationship ) && model . hasOwnProperty ( relationship ) && model [ relationship ] ) {
463
473
const relationshipModel : JsonApiModel = model [ relationship ] ;
464
474
const hasMany : any [ ] = Reflect . getMetadata ( 'HasMany' , relationshipModel ) ;
465
475
const propertyHasMany : any = find ( hasMany , ( property ) => {
You can’t perform that action at this time.
0 commit comments