Yuvraj Mudaliar
Yuvraj Mudaliar

Reputation: 375

Can one use DOM manipulations in Component in angular 2 or it should be done in Directive?

Can anyone mention the best practices for DOM manipulation in Angular 2. I have researched a lot and couldn't find best solutions. Should it be done in component itself or create directives?

Upvotes: 1

Views: 331

Answers (1)

manideep pabba
manideep pabba

Reputation: 457

Angular2 api documentation recommends to use data binding properties. If it is still not sufficient to solve your problem, you have to write a directive to access DOM elements and manipulate them. DO NOT MANIPULATE DOM ELEMENTS FROM COMPONENT

Upvotes: 1

Related Questions