abhikmitra / ng-joyride

Angular Joyride Directive for creating custom introductions to websites
126 stars 68 forks source link

Can't add ng-disabled directive #59

Open chriszamperetti opened 8 years ago

chriszamperetti commented 8 years ago

Hi, I need to add in the "nextBtn" the ng-disabled directive because that button need to stay disabled until a condition is true. Is it possible? The same thing is for ng-if or ng-class. I can't use them in the template and i don't know why.. This is my situation:

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

            }, ....

Well, as you can see i've got a custom template in which i can show the value i need: $scope.rFunction()

When i try to stamp this function that returns a boolean value outside any element of the template it's working. But if i try to put it on a directive like ng-disabled or ng-if not. Any idea? Thanks

alexdvance commented 8 years ago

Run $compile on the html. http://stackoverflow.com/a/18691160/1354137