angular.module('userApp',[]).controller('RegisterCtroller',function($scope){
$scope.username=''
$scope.password=''
$scope.confirm=''
$scope.agree=true
$scope.reg=function(){
//业务逻辑
if(!$scope.agree){
window.alert('请同意')
}
//校验用户名是否为空
if($scope.username.trim().length===0){
return window.alert('用户名不能为空')
}else{
if($scope.password===$scope.confirm){
return alert('注册成功') }
else{
return alert('密码错误') }
}
}
window.$scope = $scope
}
网友评论