@dataclouder/ngx-core 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1215,6 +1215,7 @@ class EntityBaseFormComponent {
|
|
|
1215
1215
|
this.createNewEntity();
|
|
1216
1216
|
}
|
|
1217
1217
|
}, ...(ngDevMode ? [{ debugName: "loadEntityEffect", allowSignalWrites: true }] : [{ allowSignalWrites: true }]));
|
|
1218
|
+
this.defaultNewObject = {};
|
|
1218
1219
|
}
|
|
1219
1220
|
async save() {
|
|
1220
1221
|
if (this.form.invalid) {
|
|
@@ -1273,8 +1274,9 @@ class EntityBaseFormComponent {
|
|
|
1273
1274
|
}
|
|
1274
1275
|
}
|
|
1275
1276
|
async createNewEntity() {
|
|
1277
|
+
// object is always empty, if you want a default data, set defaultNewObject
|
|
1276
1278
|
try {
|
|
1277
|
-
const newEntity = await this.entityCommunicationService.createOrUpdate(
|
|
1279
|
+
const newEntity = await this.entityCommunicationService.createOrUpdate(this.defaultNewObject);
|
|
1278
1280
|
const id = newEntity?._id || newEntity?.['id'];
|
|
1279
1281
|
if (id) {
|
|
1280
1282
|
// we replace the url to avoid creating a new entity when the user goes back
|