click第一次没有开火第二次工作

click第一次没有开火第二次工作

本文介绍了ng-click第一次没有开火第二次工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题的数据服务保留预订和

I have data service hold booking from questions and

app.factory('QuestionService',function(){
 ..........
  vm.goNext = function () {
                 var clearAnswersPromise = vm.clearInvalidAnswers();

                $q.all([clearAnswersPromise]).then(function (data) {
                    vm.checkForInvalidAnswers();
                }).then(function () {
                    vm.processNextFinal();//this will make $http call
                });
..........

});

 app.controller('formCtrl',function(QuestionService){
       var vm = this;
        vm.QuestionService = QuestionService;


});







............
 <button class="button--primary button pull-right bc-questions"  type="button" ng-click="vm.QuestionService.goNext ()">
                        Next
                    </button>
..............





第一次有效,但在我转到下一页后,我回来了到这个表单修改一些信息,这次当我点击时,按钮不会做任何事情,必须再次点击然后才能工作。



看来很奇怪,有谁知道如何解决这个问题?由于这只是不起火事件,似乎没有任何逻辑问题。我完全迷失了:(



For first time it works, but after i go to the next page, then i come back to this form modify some information, this time when I click, the button won't do anything, must click the second time then works.

It seems very strange, has anyone know how to solve this issue? Since this just don't fire event, and don't seems that have any logic issue. I am totally lost :(

推荐答案








............
 <button class="button--primary button pull-right bc-questions"  type="button" ng-click="vm.QuestionService.goNext ()">
                        Next
                    </button>
..............





第一次有效,但在我转到下一页后,我回来了到这个表单修改一些信息,这次当我点击时,按钮不会做任何事情,必须再次点击然后才能工作。



看来很奇怪,有谁知道如何解决这个问题?由于这只是不起火事件,似乎没有任何逻辑问题。我完全迷失了:(



For first time it works, but after i go to the next page, then i come back to this form modify some information, this time when I click, the button won't do anything, must click the second time then works.

It seems very strange, has anyone know how to solve this issue? Since this just don't fire event, and don't seems that have any logic issue. I am totally lost :(


这篇关于ng-click第一次没有开火第二次工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 00:27