这是我的代码
<input type="password" id="centraPassword" placeholder="Enter Centra Password" class="form-control" ng-model="centraPassword" />
<label>
<input type="checkbox" ng-model="centrapasswordcheck" >
I have a Centra Travels password
</label>
<button type="submit" class="btn btn-info" ng-disabled="continueEmailButton" id="btnContinue" ng-click="ContinueDetails()">Continue</button>
这是我的angularjs代码
$scope.ContinueDetails = function () {
if ($scope.centrapasswordcheck == true)
{
if ($scope.centraPassword == '' || $scope.centraPassword == null) {
alert("please enter your password")
return;
}
}
}
在上面的代码中,当我点击&#34;继续&#34;按钮,首先选中是否选中复选框,然后检查是否输入密码。
答案 0 :(得分:1)
myuser
var module = angular.module('myApp', []);
module.controller('myCtrl', function($scope) {
$scope.centrapasswordcheck = true;
$scope.ContinueDetails = function () {
if ($scope.centrapasswordcheck == true) {
if ($scope.centraPassword == '' || $scope.centraPassword == null) {
alert("please enter your password 1");
}
else {
alert("Password Validated");
}
} else {
alert('Please Check Checkbox');
}
alert('Coming out of the fuction');
}
});
检查一次是你想要的还是别的什么
删除警报并编码您想要的代码