In this plunk the objective is to show an error message based on validation in the controller (instead of the built-ins required or min-length). Th
required
min-length
The more proper way to do this in controller is to use $setValidity
if(a !== b){ form.inputName.$setValidity('custom-err', false); } else { form.inputName.$setValidity('custom-err', true); } form.$setSubmitted();