Using Jquery inside AngularJS directive good or bad idea?

前端 未结 3 1915
萌比男神i
萌比男神i 2021-02-07 22:00

Below you can see my code for the directive.

My question is: \" Can i use jquery with directives? Is that a good idea? If not why? \"

o         


        
3条回答
  •  孤独总比滥情好
    2021-02-07 22:28

    Interesting question. I've got some jquery with element selection in some directives/controllers in my codebase.

    I always feel dirty using it and only do it when I really need to, unfortunately it's almost always a time bomb and leads to me cursing myself a few months down the line and refactoring to use a more angulary method.

    Have one last look to see if there's a native angular way of doing what you're trying to do, you won't regret it!

提交回复
热议问题