Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';t添加ng禁用指令ngJoyride_Javascript_Angularjs_Zurb Joyride - Fatal编程技术网

Javascript Can';t添加ng禁用指令ngJoyride

Javascript Can';t添加ng禁用指令ngJoyride,javascript,angularjs,zurb-joyride,Javascript,Angularjs,Zurb Joyride,我需要在“nextBtn”中添加ng disabled指令,因为该按钮需要保持禁用状态,直到条件为真。可能吗?对于ng if或ng类也是如此。我不能在模板中使用它们,我不知道为什么。。这就是我的情况: function elementTourTemplate(content, isEnd){ return '<div class=\"row custom-color\">' + '<div id=\"pop-over-te

我需要在“nextBtn”中添加ng disabled指令,因为该按钮需要保持禁用状态,直到条件为真。可能吗?对于ng if或ng类也是如此。我不能在模板中使用它们,我不知道为什么。。这就是我的情况:

function elementTourTemplate(content, isEnd){
            return '<div class=\"row custom-color\">' +
                '<div id=\"pop-over-text\" class=\"col-md-12\">' +
                content +
                '</div>' +
                '</div>' +
                '<hr>' +
                + $scope.rFunction() +
                '<div class=\"row\">' +
                '<div class=\"col-md-8 qt-tmpl-footer-modal\">' +
                '<a class=\"skipBtn pull-left qt-margin-min\" type=\"button\">Skip</a>' +
                '<button id=\"prevBtn\" class=\"prevBtn uk-button uk-button-danger qt-margin-min\" type=\"button\">' +
                'Back</button>' +
                '<button ng-disabled=\"$scope.rFunction() == false\" id=\"nextBtn\" class=\"nextBtn uk-button uk-button-success\" type=\"button\">' +
                'Next&nbsp;<i class=\"glyphicon glyphicon-chevron-right\">'+
                '</button>'+
                '</div>' +
                '</div>'
        }

 $scope.config=[
            {  
                type: "element",
                selector: "#left-tree-folders",
                heading: "Test one",
                text: "Click here to go to the next step",
                placement: "right",
                scroll: true,
                elementTemplate: elementTourTemplate

            }, ....

我的猜测是angular没有编译模板,因此没有跟踪html中的任何更改。这可防止ng if和ng disabled在摘要循环中重新评估。如果使用angular的$compile服务编译模板,则可能会起作用:

elementTemplate: $compile(elementTourTemplate)($scope)

谢谢你的回答。我试过了,但现在我遇到了另一个问题:scope.$new不是函数,请查看编辑后的问题以查看整个错误。似乎在ng-joyride.js代码this.popoverTemplate=config.elementTemplate(this.content,isEnd)的这一行中生成了错误;嗯,似乎在指令之外使用$compile需要一些额外的东西。请参阅已编辑的答案,将$scope传递给$compiler页面现在不加载,过了一段时间,我发现这一个调用堆栈的最大大小超过了。对不起,伙计,我没有主意了。这似乎与驾驶乐趣有关。但我注意到你在他们的github上打开了一个问题,这可能是你最好的机会。祝你好运,我希望你能明白!
elementTemplate: $compile(elementTourTemplate)($scope)