I have two factories (because it is more readable) and one controller. I do not know if it is possible, but I want to sent the result of the two factories in one variable.
code
vm.result = [];
vm.validate = validate;
function validate(password1, password2) {
vm.result = comparePasswordFactory.compare(password1, password2) + validNumberFactory.valid(password1);
return vm.result;
}
compare returns:
return {
color: 'green',
text: 'Passwords match',
validate1: 'true'
};
valid returns:
return {
text: 'Number should be between 12 and 45',
validate2: 'false'
};
I do not think what I wrote is correct. But, is this possible and/or is it a good option ?