Utilizing AngularJS, my JSON call can result in various errors. Currently, I am handling it like this:
$scope.errors = object.data.form.ERRORS
or
$scope.errors = object.data.system.ERRORS
However, in the future, 'form' or 'system' may change, so is there a way to access the errors without specifying them directly? Can I use something like object.data[1].ERRORS
since errors are always present and located as the first element of the data?
This is how my data appears:
Object {member-participant: Object}
system: Object
ERRORS: "Email address already exists."