1
votes

I'm rather new to angular and I'm trying to use Angular Wizard.

https://github.com/mgonto/angular-wizard

I have my code in plunker, and I have the wizard running. However, I'm having trouble getting the validation functions to be called. I'm guessing I'm going out of scope somewhere. I set the validation functions to return false, but I'm still continuing to the next step.

However, the function for the wizard being completed is being called.

HTML

  <wz-step title="Starting" canexit="exitValidation">
    <h1>This is the first step</h1>
    <p>Here you can use whatever you want. You can use other directives, binding, etc.</p>
    <input type="submit" wz-next="" value="Continue" />
  </wz-step>
  <wz-step title="Continuing" canenter="enterValidation">
    <h1>Continuing</h1>
    <p>You have continued here!</p>
    <input type="submit" wz-next="" value="Go on" />
  </wz-step>

JS

var app = angular.module('registration', ['mgo-angular-wizard']);

app.controller('WizardController', ['$scope', 'WizardHandler',
  function($scope, WizardHandler) {

    $scope.finishedWizard = function() {
      alert('Completed!');
    };

    $scope.enterValidation = function() {
      alert('entering validation');
      return false;
    };

    $scope.exitValidation = function() {
      alert('exiting validation');
      return false;
    };
  }
]);

http://plnkr.co/edit/QR9mpXH67ErhUzAKmN4c?p=preview

This question is different from the below because step validation was added after it was asked.

I'm trying to get form validations to work with an Angular Wizard

1

1 Answers

0
votes

If you are using the newest version of angular wizard (0.5.5) it works. There was probably a bug in the older version. Here is a working Plunker

http://plnkr.co/edit/QR9mpXH67ErhUzAKmN4c?p=preview

Here are the URLs

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-wizard/0.5.5/angular-wizard.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-wizard/0.5.5/angular-wizard.css" />