I'm trying to validate user's input onto the email address field inside a form, and I used to create a span in which the error message gets generated in the case of typing an invalid value. This is the span HTML code:
<div ng-app="app" ng-controller='signupCtrl'>
<span style="padding: 2px 0 2px 16px; color: red;" ng-if="check_mail()">Please type a valid email address</span>
</div>
I used the ng-if tag for conditionally binding the error message
Please type a valid email address
, and check_mail() function for checking the value from a signupCtrl controller.
The check_mail function works fine as expected. However the error message was never displayed though. So is there anything wrong on my HTML code? How is it possible to solve this problem?
Thanks.
check_mailfunction?return trueor!check_mail()