I'm currently using a factory to pass in a response to a controller. The issue that i am having...is that the response doesnt become defined until i press submit.
my factory (responseHandler
):
return {
setMessages: function(response) {
if (response === undefined) {
return false;
} else {
return response;
}
}
};
my controller:
$scope.messages = responseHandler.setMessages();
it works when i manually put a string into the setMessages function but doesnt work when i pass in a response. Any help would be great
thanks
EDIT:
in the response i am getting an array of just some string for ex..
[
{
"message":"Title required"
},
{
"message":"No first and last name"
},
{
"message":"No address info"
},
{
"message":"Cannot submit"
}
]