我需要验证登录功能。我添加了我的Login.html文件和LoginController.js文件。我想验证这从使用这个JavaScript。这是angularjs代码。之后,我必须为此代码设置php网址。如何验证表单使用if语句中的javascript角
的login.html
$scope.submitForm = function() {
\t \t var user_email = user_email;
\t \t var user_password = user_password;
\t \t if(user_email && user_password){
\t \t \t console.log(user_email);
\t \t }
\t \t
\t };
<div ng-controller="LoginController">
<form name="userForm" ng-submit="submitForm()">
<div class="list">
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text" name="user_email" ng-model="user.user_email" required>
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password" name="user_password" ng-model="user.user_password" required>
</label>
</div>
<span ng-show="userForm.user_email.$touched && userForm.user_email.$invalid">The Username is required.</span> </br>
<span ng-show="userForm.user_password.$touched && userForm.user_password.$invalid">The Password is required.</span>
<button class="button button-block button-positive activated">Sign In</button>
<button onclick="location.href='#/login/:friendId/register/';" class="button button-block button-positive activated">Register</button>
</form>
</div>
我猜你以前没有做任何研究吗? –
我没有任何想法请你给我回答 – moni123
https://scotch.io/tutorials/angularjs-form-validation –