You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mapping arrays, options.parent is set to an observable containing an empty array regardless of the jsObject or target parameter. Normal properties receive the target model as options.parent.
It would be great if the create method would always receive the target model regardless of the type of property being mapped.
Use case: Mappings where access to the target model is required while mapping array elements.
The text was updated successfully, but these errors were encountered:
The update callback already receives the target, so you can specify that as a temporary workaround. The update callback is called immediately after the create, and also during any updates.
It should not be a problem to add the target to the create callback as well, though. I'll see what I can do.
In order to see what is really happening you should put some console.log statements inside the create and update functions. You should easily see that the parent is always pointing to an empty array - regardless of the previous content of Bag.items.
I just opened issue #35 which is slightly related to this.
When mapping arrays, options.parent is set to an observable containing an empty array regardless of the jsObject or target parameter. Normal properties receive the target model as options.parent.
It would be great if the create method would always receive the target model regardless of the type of property being mapped.
Use case: Mappings where access to the target model is required while mapping array elements.
The text was updated successfully, but these errors were encountered: