Currently, I have a form with a list of editable objects (constants). Previously, it was possible to delete any object without confirmation. Now, I want to add a ngBootbox confirm step before the deletion process.
In my .ts file, the code for deleting an object is as follows:
public DeleteMyObject(constantName: string): void {
DeleteConstant(constantName);
this.ConstantsNavigationForm.$setDirty();
}
The view:
<ng-form name="Vm.SoftSensorDialogComponent().ConstantsForm">
<ng-form class="st-table-container" name="Vm.SoftSensorDialogComponent().ConstantsNavigationForm">
<button type='button' "
ng-click="Vm.SoftSensorDialogComponent().SoftSensorDialogConstants.DeleteSoftSensorConstant(dataItem.Name)"></button>
</ng-form>
</ng-form>
Deleting an object now updates the form immediately.
I have added an additional step in my .ts file:
public Request_DeleteConstant(constantName: string) {
let options = {
message: "<h4>Are you sure you want to delete :" + constantName + " ?</h4>",
buttons: {
cancel: {
label: "CANCEL",
className: ""
},
confirm: {
label: "OK",
className: "",
callback: () => {
this.DeleteConstant(constantName);
}
}
}
};
this.softSensorDialog.$ngBootbox.customDialog(options);
}
Now, a bootbox confirmation dialog appears before deleting an object. However, the form is not updated after a successful operation. It seems to be related to the callback function. Is there a way to manually refresh or update the form?