Fairway Technologies Blog

blog
October 27, 2017 | Paul D. Sheriff

Pluralsight Courses by Fairway Technologies

You may not know, but two principals at Fairway Technologies are published authors at Pluralsight.com. Pluralsight is the leader in online technology courses. Paul D. Sheriff and Michael Krasowski have created over 20 courses covering topics from Project Management, Estimation to WPF, MVC and Angular. Check out the complete list of the courses produced to date.

April 25, 2014 | Jeff Treuting

Simplifying AngularJS form validation with a custom directive - Part 1. client side

Summary

When I started using AngularJS I quickly came across the need to do form validation and display appropriate error messages to the user.  Naturally I did some searching of the interwebs to find examples and tutorials on how to get this done quickly and easily.  All of the examples I found seemed to show the same basic approach which was to have multiple error message divs for all of the possible error messages attached to a particular field, and use ngShows to control which, if any, is displayed.  This works great, but it felt like a lot of redundant code to me and it also didn't take care of displaying any server-side validation messages for me.  I decided to create a custom directive to handle this for me so that I could be more productive, and my inspiration was the ASP.NET MVC Html.ValidationMessageFor() single call that handles multiple error messages within an MVC view.

Plan Your Technology Team with This Online Assessment Tool

Subscribe to Email Updates

Build a Rock Start Tech Team with This Online Assessment | Fairway Tech