In Angular, should DOM operations be placed in the controller or the directive?
Put it in the directive.
The controller must not be able to operate the dom. The controller is the data on the operation page.
Directive is required to operate DOM. For relevant angular writing specifications, please refer to: https://github.com/johnpapa/angular-styleguide#manipulate-dom-in-a-directive
Put it in the directive.
The controller must not be able to operate the dom. The controller is the data on the operation page.
Directive is required to operate DOM. For relevant angular writing specifications, please refer to:
https://github.com/johnpapa/angular-styleguide#manipulate-dom-in-a-directive