-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
AngularJS Directives Cookbook
By :
In this chapter, we have seen a different way to declare a directive to manipulate the DOM. In the previous chapter, we explored different ways of working with the directive's properties. In this example, we will declare an external controller to the directive without writing any code within the directive.
Using external controllers is very common in applications that have many customized directives. They help us separate the content in a more practical way, in the same behavior of the directives template. With separated controllers, we can use many AngularJS resources, such as services and other features.
This example serves to illustrate the flexibility that directives have.
We will use the same code as the previous example, but this time, we will place the controller's code in a separate file.
'use strict'; /** * @ngdoc function...
Change the font size
Change margin width
Change background colour