Reputation: 375
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
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