Controller-side validation for Angular.JS