Basically I have angularjs validation ready to go on the example below.
<input type="text" maxlength="60" class="form-control" id="inputFirstName" name="firstName" placeholder="" ng-model="formData.firstName" required="">
<div ng-show="admission-form.$submitted || admission-form.firstName.$touched">
<span ng-show="admission-form.firstName.$error.required">First Name is required<br></span>
</div>
So I can get the css to highlight the field when invalid but I still am not getting the message to show. I see that from chrome's dev tools that both ng-invalid-required and ng-touched are on the firstName input. What am I missing?
Some other notes: I do have the form named admission-form but it is on another html file and directed to it from angular-ui-router. All the form pages are nested under the same controller.
Let me know if there is any other information that would be helpful. I am still fairly new to angular.
********EDIT********
As requested the state config. The page goes index.html nests form.html which nests each page of the form. The one for this input in the personalInformation.html page.
angular.module('admissionsApp', ['ui.router', 'ui.mask', 'ui.bootstrap'])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
// route to show our basic form (/form)
.state('home', {
url: '/home',
templateUrl: 'home.html',
controller: 'HomeController'
})
.state('form', {
url: '/form',
templateUrl: 'form.html',
controller: 'FormController'
})
.state('form.personalInfo', {
url: '/personalInfo',
templateUrl: 'personalInformation.html'
})
name
property set on your form? I don't have a way to check it quickly but I don't believe theadmission-form
is a correct name. Try changing it fromname="admission-form"
toname="admissionForm"
and then<div ng-show="admissionForm.$submitted" ......