I would like to be able to add a CSS class to the text color of a message based on the response.
Currently I do it this method:
if (response.data.status == 201) {
angular.element(document.getElementById("msg")).css("color", "green");
$scope.msg = 'Users created for Meeting ' + r.id
+ ' on ' + $filter('date')(r.updated_at, 'M/d/yyyy')
+ ' at ' + $filter('date')(r.updated_at, 'HH:mm:ss');
console.log("Status Code= " + response.data.status + ", Status Text= " + response.data.message);
return true;
}
else {
angular.element(document.getElementById("msg")).css("color", "red");
$scope.msg = r.message;
angular.element("#meeting-id").focus()
console.log("Status Code= " + response.data.status + ", Status Text= " + response.data.message);
return false;
}
and it works, but now I have two classes that can be added to the success and error messages. I need to figure out how to add them so that I can remove the style attribute that changes the text to red or green.
The classes names are:
• Success: “text-green”
• Error: “text-red”
What is the method to correctly achieve this?
Any help would be great.
Thank you, Erasmo