简体   繁体   English

用于angular js中DOM操作的自定义指令

[英]Custom Directive for DOM manipulation in angular js

Is it good or bad to use many custom directive for DOM manipulation in Angular js. 在Angular js中使用许多自定义指令进行DOM操作是好是坏。 from reading Angularjs.org I came to know that the best way to manipulate DOM is through custom directive in Angular js. 通过阅读Angularjs.org,我知道操纵DOM的最佳方法是通过Angular js中的自定义指令。 But what if I want to manipulate many DOM Elements I have to create many custom directive I don't know whether it is good or bad practice. 但是,如果我要操纵许多DOM元素,该如何创建许多自定义指令呢?我不知道这是好还是坏的做法。 Does many custom directive cause any delay in functionality. 是否有许多自定义指令会导致功能延迟? Please help me out 请帮帮我

Custom Directives never create problem.In fact it solves the problem of delay in functionality.I would recommend you to use in build directives and in case if you want you can create Custom Directive. 自定义指令永远不会造成问题,实际上它解决了功能延迟的问题,我建议您在构建指令中使用,以防万一您可以创建自定义指令。 It will not create any problem for your application. 这不会对您的应用程序造成任何问题。

Actually one of the reasons to use directives is DOM manipulation. 实际上,使用指令的原因之一是DOM操作。 You can also keep your controllers clean and reuse HTML. 您还可以保持控制器干净并重用HTML。 Normally, applications that requires a lot of user experiences (through DOM manipulations) also requires reusable directives. 通常,需要大量用户体验(通过DOM操作)的应用程序还需要可重用的指令。

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM