-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
AngularJS Directives Cookbook
By :
Continuing within the context of the previous examples, we will now create a custom directive to validate some form fields. This recipe applies to any type of form field; however, we will use the <select> tag.
AngularJS offers some very useful resources for form validation with built-in directives. We will create a component that can be reused elsewhere in our application.
Just as we did in the previous chapters, we will continue using the same application created in the previous recipe.
In this example, we will use an external library called ngMessages.
For the purpose of this example, we just add the library as a dependency in our index.html, using a
Content Delivery Network (CDN), as we did in the previous recipe.
Add the following link to the index.html file:
<!-- Ng Messages--> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular-messages.min.js"></script> <!-- Ng Messages-->...
Change the font size
Change margin width
Change background colour