I am looking for a way to eliminate all whitespace from three fields (leading, trailing, and between characters) before they are sent to the backend via an Angular post request. The data is coming from the form data object. Currently, I have managed to achieve this by creating a custom deserializer for Jackson, but I would prefer to clean up the data before it reaches my Spring backend.
function insertNumber(form, result) {
NumberSequence.save({"type": form.$name}, form.$data,
success(result),
error(form, result));
}
The data consists of 3 fields:
- start
- end
- number
I need to strip whitespace from all three fields.
Does anyone have any suggestions on how to accomplish this?