1
我有兩個形式註冊的,並與下單控制器寫有兩個函數調用上正確提交的第一種形式的工作,但在註冊始終顯示錯誤 預覽這裏https://plnkr.co/edit/RS2LVc?p=preview角度驗證錯誤
var app = angular.module('abc', []);
app.controller('login', function ($scope) {
scope.LoginValidator = function ($event) {
if ($scope.LoginForm.$valid) {
console.log('Logged In');
} else {
console.log("invalid");
if ($scope.LoginForm.Email.$invalid) {
$scope.mailRequire = true;
}
if ($scope.LoginForm.password.$invalid) {
$scope.passRequire = true;
}
$event.preventDefault();
}
};
然後碼登錄第二個功能從這裏開始,並顯示錯誤
$scope.SignupValidator = function ($event) {
if ($scope.SignupForm.$valid) {
console.log("Valid");
} else {
alert('InValid Data');
if ($scope.SignupForm.Fullname.$invalid) {
$scope.namerequire = true;
}
if ($scope.SignupForm.email.$invalid) {
$scope.emailrequire = true;
}
if ($scope.SignupForm.rollno.$invalid) {
$scope.rollrequire = true;
}
if ($scope.SignupForm.password.$invalid) {
$scope.passwordrequire = true;
}
if ($scope.SignupForm.confirm.$invalid) {
$scope.confirmrequire = true;
}
$event.preventDefault();
}
};
});