Skip to content

Improve pf-wizard validation #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
benjaminapetersen opened this issue Jun 14, 2017 · 0 comments
Open

Improve pf-wizard validation #493

benjaminapetersen opened this issue Jun 14, 2017 · 0 comments

Comments

@benjaminapetersen
Copy link
Member

benjaminapetersen commented Jun 14, 2017

Original issue in origin-web-console.

The example in the original issue is this:

var validityWatcher;
// ...
// in a setup fn:
validityWatcher = $scope.$watch("ctrl.selectionForm.$valid", function(isValid) {
     ctrl.steps[0].valid = isValid;
});
// ... 
// in another fn:
      if (validityWatcher) {
        validityWatcher();
        validityWatcher = undefined;
      }
// 
// in a cleanup fn:
    ctrl.$onDestroy = function() {
      if (validityWatcher) {
        validityWatcher();
        validityWatcher = undefined;
      }
// ...

There is a lot of bookkeeping involved for validation & it feels a bit out of sync with typical angular validation. The ideal option is to get it in the view, but a secondary option might be to get a validation function added to the steps & hide the setup/tear down code from the user (hide by adding an ng-form behind the scenes, perhaps w/a name = to the step.id or step.id+rand and then toggling its $valid property based on the validator fn).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants