I want to check all the validations of the form fields on click of submit button and fire missing or wrong field validation before submitting data
like in previous version of angular on submit we can fire all error validation if form state is invalid
if (scope.sampleForm.$valid) {
// success code
} else {
angular.forEach(scope.sampleForm.$error, function (field) {
angular.forEach(field, function (errorField) {
errorField.$setTouched();
})
});
}
I check many answer related to this and most answer is disabled submit button if form is invalid, I want to achieve this without disabling button, please suggest me how I can do achieve this? I am using template driven approach angular (v4)