Currently, I have a basic CRUD application that is operational. However, I am looking to enhance every response received from the server by adding two additional parameters:
'error' => boolean, 'errorMessage' => string, 'data' => {whatever data}
This modification will allow me to effectively manage successful requests returned from the server. In case the database fails to update for any reason, I can ensure that the UI remains synchronized with the DB and display an error message to the user upon a failed update.
AngularJS necessitates an updated object for proper UI synchronization upon failure scenarios. By returning the same object on failure, the UI stays in sync but lacks notification of the failure condition to the user.
In my prior applications which were jQuery-based and pre-Angular, I could easily decode JSON data on each response. If 'error === true', I would be able to show an error message. Unfortunately, I am struggling to implement this functionality in Angular.
Since I am relatively new to Angular, any guidance or support in this matter would be greatly appreciated.