I'm having trouble detecting if a specific text is present within a string. Even though the text I am looking for is clearly there, my code seems to ignore it and goes straight to the else part of the statement.
Here is the snippet of code causing the issue:
if (response.data.indexOf("Panelists sucessfully added Meeting ID") > 0) { < this check
$scope.IsColor = true;
$scope.Messages = response.data;
angular.element("#msg").focus()
return true;
}
else {
$scope.IsColor = false;
$scope.Messages = response.data;
angular.element("#msg").focus()
return false;
}
Here is the content of response.data:
response.data[0]: "Panelists successfully added Meeting ID: 94395753143 on 07/31/2020 at 01:53:17 PM"
Screenshot:
https://i.sstatic.net/f6Mdh.png
Could it be that indexOf is not suitable for checking if a value exists within a string in an array?
Any help or suggestions would be greatly appreciated.
Thank you, Erasmo