jQuery find() method not working in AngularJS directive

前端 未结 7 987
说谎
说谎 2021-01-31 14:26

I am having trouble with angularjs directives finding child DOM elements with the injected angular element.

For example I have a directive like so:



        
相关标签:
7条回答
  • 2021-01-31 15:31

    From the docs on angular.element:

    find() - Limited to lookups by tag name

    So if you're not using jQuery with Angular, but relying upon its jqlite implementation, you can't do elm.find('#someid').

    You do have access to children(), contents(), and data() implementations, so you can usually find a way around it.

    0 讨论(0)
提交回复
热议问题