-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Custom ValidationController #469
Comments
Ok. Small update. It is supported by using "& validate:validationController". So it's actually supported functionality, but we always have to type the validation controller. It will be nice if we can do it once in configuration for example. :) Thanks |
If you create a gist that shows what you're doing I'll be able to help. |
Here is a working example: https://gist.run/?id=9f117dd3f760035c67a64e90c2f62d33 P.S. I just add a property to the validation controller to show me if there is ANY errors. Just a boolean. This way I can disable the submit button on initial load. But that's not the issue. The issue is that using a custom validation controller is possible...but I have to type it in every input. The idea was to make it possible by configuration to be typed once. :) |
use |
I think I've run into the same problem... or at least something similar. I've reproduced the problem easily. Given this template..
...and this view model...
... we see the following exception in the browser console window any time we edit the template:
In other words, as soon as we save the file, HMR tries to reload the template and that exception occurs. Of course, I can refresh the page to fix the problem, but that negates the usefulness of HMR. Now, if I remove Hopefully these details will help diagnose the problem. We would love to be able to use HMR and the validate plugin at the same time. |
Hrmmm.. Looking elsewhere, I discovered that changing |
I have the exact same issues as @alexdresko, also using Webpack with HMR. And the proposed workaround (passing the validation controller to |
`recreateView` creates a new container but did not copy the resolvers from the old container. This caused local DI instances (eg. injected into the controller via `NewInstance.of`) to be missing. This fixes aurelia/validation#469, at least the HMR issue described by @alexdresko.
I am trying to extend the ValidationController.
I started with this:
It works fine.
But when I add the '& validate' biding behavior in my form I get:
"Error: A ValidationController has not been registered."
The "problem" is that the base binding behavior (validate-binding-behavior-base.ts) is using this line to get the controller:
"controller = source.container.get(Optional.of(ValidationController));"
and it does not exist in my class (it's CustomValidationController).
Any ideas how to work around this? Will any future releases allow such functionality?
Thanks.
The text was updated successfully, but these errors were encountered: