Writing Custom Validations - Part 4

Today we will cover the last two steps on the progression. We added some basic validation (Part1), then we created a validation on a single form control (Part1), we raised the bet creating a custom validation over a complex object (Part2). We took some distance and refactored our code to make it a reusable component (Part3). And now we will make sure we handle multiple instances and its multiple errors in a semantic efficient fashion that provides the user a much better experience.

AngularJS - Checkbox with default value

In the following example, we set the values for our checkbox using ng-checked. The default values are set using ng-init; the same result is accomplished by initializing the value in the controller. When the user marks the checkbox as checked, we use the ng-click to change the value from true to false, or vice versa.

AngularJS - Basic Filters

One of the features that makes AngularJS standout is the ability to bind the model with the views without having to write controller code to connect things together. More over it keeps them in sync, so for example, if the view either the view or the model are updated it refreshes the other automatically

AngularJS - Services - Initializing Complex Objects

Lets say we want to model the object we retrieved from our backend. We want to modify some data, concatenate other and we want to add some functions so we can call them on the fly at presentation layer. Lets assume our e-commerce site’s backend just retrieved a saved shopping cart (a la amazon). It contains a saved shopping cart holding product with a title, description, quantity, price, taxes, fees, etc.

Welcome to ng-learn

This is a Zero to Ninja site dedicated to learn AngularJS. One of the common complains about AngularJS is it’s documentation, which to the eyes of the newcomers can be cryptic and hard to digest. In part the problem comes from the fact that AngularJS is still a young technology but also because there are usually multiple ways to do things.

Author: Bluescreen, Tags: Beginner , comments