I want to validate my form with ng-disable.
So my function will check if the ID the user entered is correct.
Also I will have to check my form if all the inputs are filled up.
This is my Function:
vm.validateid = function(){
console.log('here');
var objvar = {
'id': vm.data.referalid,
'referral2': true,
};
$http.post(ConfigCnst.restUrl,objvar).then(function(res) {
if (res.data.status !== true) {
alert('Invalid ID');
vm.data.referalName = 'Invalid ID';
vlid = res.data.status;
console.log(vlid);
} else {
alert('ID Validated');
vm.data.referalName = JSON.stringify(res.data.data.name);
vlid = res.data.status;
console.log(vlid);
}
});
}
I want to take vlid. It will either contain true or false.
This is my ng-disable:
<button ng-disabled="registerForm.$invalid"
ng-click="register.submit()"
class="button button-block button-positive">Confirm</button>
I want to check both registerForm and vlid as both false.
Is there a way to reference my vlid from my controller?
all are filled up... if use validation attributes/directives form will stay$invalid=trueuntil requirements are matched on all fields and each field becomes$valid=true. In other words you shouldn't need to check again in client....but always revalidate at server