Angularjs Ng显示不适用于表单验证
我正在尝试使用ng show,但由于一些奇怪的原因,它没有出现在屏幕上。 当用户点击第一个名字时,它应该从未被触碰转换为被触碰,但仍然没有出现错误代码Angularjs Ng显示不适用于表单验证,angularjs,validation,ng-show,Angularjs,Validation,Ng Show,我正在尝试使用ng show,但由于一些奇怪的原因,它没有出现在屏幕上。 当用户点击第一个名字时,它应该从未被触碰转换为被触碰,但仍然没有出现错误代码 <form role="form" novalidate> <h2>Please Sign Up</h2> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-6">
<form role="form" novalidate>
<h2>Please Sign Up</h2>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" class="form-control input-lg" name="fname" ng-model="registerViewModel.first_name" placeholder="First Name" tabindex="1" required="" />
<div ng-show="form.fname.$touched">
<div ng-show="form.fname.$error.required">Tell us your name</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="text" class="form-control input-lg" ng-model="registerViewModel.last_name" placeholder="Last Name" tabindex="2">
</div>
</div>
</div>
<div class="form-group">
<input type="email" class="form-control input-lg" ng-model="registerViewModel.email" placeholder="Email Address" ng-model="email" tabindex="4">
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="password" class="form-control input-lg" ng-model="registerViewModel.password" placeholder="Password" tabindex="5">
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="form-group">
<input type="password" class="form-control input-lg" ng-model="registerViewModel.confirmPassword" placeholder="Confirm Password" tabindex="6">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-8 col-sm-9 col-md-9">
By clicking <strong class="label label-primary">Register</strong>, you agree to the <a href="#" data-toggle="modal" data-target="#t_and_c_m">Terms and Conditions</a> set out by this site, including our Cookie Use.
</div>
</div>
<hr class="colorgraph">
<div class="row">
<div class="col-xs-12 col-md-6"><input type="button" ng-click="adminRegister.registrationRequest()" value="Register" class="btn btn-primary btn-block btn-lg" tabindex="7"></div>
</div>
</form>
请注册
告诉我们你的名字
单击注册,即表示您同意本网站规定的内容,包括我们的Cookie使用。
您的表单没有名称。您应该这样定义它:
<form role="form" name="myname" novalidate>
然后用它的名字myname.fname…