Here is a snippet of code I am working with:
$http(request)
.success(function(data){
...
})
.error(function(data){
...
});
An ongoing issue I am facing is when the response contains an error. The JSON response shows the error message under data.error, but currently, the way my code is set up, even when there's an error, it registers as successful instead.
What would be the most effective approach to address this? Could simply adding an if statement like below resolve the problem?
if (data.error){ ....