I’m trying to use the ng-messages for my form validation as follows:
<form name="userForm">
<div class="field">
<label for="emailAddress">Enter your email address:</label>
<input type="email" name="emailAddress" ng-model="data.email" required />
<div ng-messages="userForm.emailAddress.$error">
<div ng-message="required">
You forgot to enter your email address...
</div>
</div>
</div>
</form>
I have included the angular-messages library after the ionic bundle and declared ngMessages as a dependency on my main module but i still get this error:
PS: ionic version 1.3.11, angular 1.3.15, angular-messages 1.3.15
Error: [$compile:ctreq] Controller ‘ngMessages’, required by directive ‘ngMessage’, can’t be found!
http://errors.angularjs.org/1.2.25/$compile/ctreq?p0=ngMessages&p1=ngMessage
at VALIDITY_STATE_PROPERTY (http://localhost:8100/lib/ionic/js/ionic.bundle.js:7703:12)
at getControllers (http://localhost:8100/lib/ionic/js/ionic.bundle.js:14168:19)
at nodeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:14337:35)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13730:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13733:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13733:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13733:13)
at nodeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:14330:24)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13730:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13733:13)
What could be the cause of this?