What is the equivalent of `link` function in Angular to access DOM elements

Viewed 2427

There are examples of setting the link attribute on Angular 2 directives to register callbacks that transform the DOM.

An example is creating directives for D3.js graphs. See this pen:

enter image description here

The link attribute:

Directives that want to modify the DOM typically use the link option to register DOM listeners as well as update the DOM. It is executed after the template has been cloned and is where directive logic will be put.

The API for Angular 4 directives is very different. How is similar functionality achieved in Angular 4?

1 Answers
Related