Step 4, is for us to use Angular Form bound objects,
in order to effect our UI and give feedback to the user.
In this case, you could see that we have an error message that is wrapped with
a span and a ng-if.
Which means it will only show up, if the things inside of the value for
the ng-if attribute are true.
In this case you see we have formName.name,
meaning the name of our input field, .$error.required.
So we're saying that if that's true, and.
&& stands for and, formName which is again the Form.
With the name that we declared it which was formName.name,
referring to the input field with the name attribute, equal to name.$touched.
All of these object, are being made available to us by Angular.
The reason you're able to refer to the Form object by its name, and
access the input fields.
Through a familiar dot notation is because when Angular compiles
HTML contained with the ng-app directive.
And sees the form tag.
It automatically creates a special controller, called form controller.
Who's instance is attached to our dollar sign scope,
with the name that the format should name specifies.
This process is very similar to the controller as syntax,
where our controller is attached to the dollar sign scope.
With the name we specify as our label.
Inside the Form controller, Angular creates a bunch of objects that keep
track of the requirements and validity.
Of each named input contained, in the form.
We can then access those objects using the formName,
as well as the names of the input fields.
So in this example, we're using the ng-if directive,
passing it an expression that will evaluate to either true or false.
If both are true, meaning that the name input field has a validation error.
And it has been touched, signified by the $touched property.
The error message, name is required will appear on the screen.
The $touched property, is an input state indicator.
It's true if the user clicked into our input field, in other words,
touched it in some since.
Since we don't want an error message displayed,
before the user even had a chance to try to enter a value.
We add this condition, to prevent that.
If the user clicked into the text box, and still left it blank by clicking out of it,
the error message, Name is required, will be displayed.