jQuery find() method not working in AngularJS directive

前端 未结 7 988
说谎
说谎 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:30

    If anyone is looking to grab the scope off of a 'controller as' element,.. something like this:

    use the following:

    var vm = angular.element(document.querySelector('#firstctrl')).scope().vm;
    

提交回复
热议问题