I am using jquery steps in my angularjs app. I have used a custom directive to init the jquery plugin. Now I need to validate all input once the finish button is clicked on the final steps of the form. In order to do that I know there is a option which needs to be set called onFinished. Now how do I call my controller method in this section?
app.directive('step', [function() {
return {
restrict: 'EA',
scope: {
stepChanging: '='
},
compile: function(element, attr) {
element.steps({
labels: {finish: "SUBMIT"},
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
stepsOrientation: "vertical",
onFinished: function (event, currentIndex) {
console.log("submit button has been clicked");
$scope.validator(); //problem here
}
});
return {
//pre-link
pre:function() {},
//post-link
post: function(scope, element) {
//element.on('stepChanging', scope.stepChanging);
}
}
}
};
}])