You can create a custom directive whenever the built-in directives don’t meet your needs, when you want to express complex functionality in code rather than in HTML, or when you want to create a self-contained unit of functionality that you can use in multiple AngularJS applications. I’ll show you examples of each of these types of directive in this chapter. Table 15-2 summarizes why and when to create custom directives in an AngularJS application.
Source: Freeman Adam (2014), Pro AngularJS (Expert’s Voice in Web Development), Apress; 1st ed. edition.