An important observation when we talk about directives and interface components is to understand that this is just an analogy between them, since the following doubt may arise: are not they the same thing? Not exactly.
The component is a code snippet that can be connected to any code block and still behave as expected. Even in different code blocks.
A directive often receives or handles data from external sources, so for it to behave the same way, interacting with different data sources needs some adjustments.
Here, we will see a way to create a directive and encapsulate its contents to get the same result.
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 that, by itself, is already a component, a very powerful charts library called d3.js
.
Beyond it, we will use another library called c3.js
. In an instant, you will understand...