Angularjs Ng单击在触发angular中另一个模块的单击时未被激发

Angularjs Ng单击在触发angular中另一个模块的单击时未被激发,angularjs,angularjs-ng-click,Angularjs,Angularjs Ng Click,我在模块中创建并注入了一个表单转盘 在表单转盘中,有一个按钮用于导航到下一个字段 从我的应用程序中,当选项卡离开我的字段时,我想调用此按钮。 这是我的密码 var testFile = angular.module('testModule',['new-form-carousel','ngAnimate']); testFile.controller('mainController',['$scope',function(s){ s.data = {'name':'','passwor

我在模块中创建并注入了一个表单转盘

在表单转盘中,有一个按钮用于导航到下一个字段

从我的应用程序中,当选项卡离开我的字段时,我想调用此按钮。 这是我的密码

var testFile = angular.module('testModule',['new-form-carousel','ngAnimate']);

testFile.controller('mainController',['$scope',function(s){
    s.data = {'name':'','password':''}

    s.pintThem = function(){
        console.log(s.data);
    }

    s.callNext = function(){

        setTimeout(function() {
            console.log($('a[ng-click="next()"]'));
            $('a[ng-click="next()"]').trigger('click');
        },10);

    }
}]);
这是我的控制器

这是我想从中调用下一个方法的字段

 <div>
            Name: <input type="text" ng-model="data.name" ng-blur="callNext()">
        </div>
此处显示上述指令的html:

formCarousel.directive('carousel', [function() {
    return {
        restrict: 'EA',
        transclude: true,
        replace: true,
        controller: 'CarouselController',
        require: 'carousel',
        templateUrl: '../app/html/carousel.html',
        scope: {
            interval: '=',
            noTransition: '=',
            noPause: '='
        },

        link:function(scope,element,attrs,controller){

        }
    };
}]);
<a class="left carousel-control" ng-click="prev()" ng-show="slides.length > 1"><span class="glyphicon glyphicon-chevron-left"></span></a>
    <a class="right carousel-control" ng-click="next()" ng-show="slides.length > 1"><span class="glyphicon glyphicon-chevron-right"></span></a>


我想从html中调用转盘的next()方法。

我已经解决了我所面临的问题

我没有使用jquery选择器和触发器,而是使用了angular选择器和triggerhandler,它工作得很好

以下是修复方法:

setTimeout(function() {
        angular.element( document.querySelector('a[ng-click="next()"]')).triggerHandler('click');
        },10);

你能创造一个木偶或小提琴吗。使用
$timeout
而不是
setTimeout
。2.您应该在
指令
内部操纵
DOM
。我不想触碰该指令,因为它必须在不同的地方使用。因此,我正在寻找一种修复方法,当我从输入字段中取出标签时,我可以调用next()方法或调用carousel的下一张幻灯片