<form novalidate ng-app="LoginApp" ng-controller="LoginController" rc-submit="login()"> <div ng-class="{'has-error': rc.loginForm.needsAttention(loginForm.username)}"> <input type="text" placeholder="Username" required ng-model="session.username" /> <span ng-show="rc.form.needsAttention(loginForm.username) && loginForm.username.$error.required">Required</span> </div> <div ng-class="{'has-error': rc.loginForm.needsAttention(loginForm.password)}"> <input type="password" placeholder="Password" required ng-model="session.password" /> <span ng-show="rc.form.needsAttention(loginForm.password) && loginForm.password.$error.required">Required</span> </div> <div> <button type="submit" value="Login" title="Login"> <span>Login</span> </button> </div> </form>
样式如下
前端验证通过会调用login()。
您可能感兴趣的文章: