I'm trying to configure Aurelia Validation (release 0.2.6) to get all of the validation messages appended to <input>
element instead of label.
My main.js looks like this:
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-validation', (config) => { config.useLocale('de-DE').useViewStrategy(ValidateCustomAttributeViewStrategy.TWBootstrapAppendToInput); });
aurelia.start().then(a => a.setRoot('app', document.body));
}
I alway get the following error message:
Unhandled promise rejection ReferenceError: ValidateCustomAttributeViewStrategy is not defined
What am I doing wrong?
Looks like this just recently changed. So as of 10/12/2015 this works:
import { TWBootstrapViewStrategy } from 'aurelia-validation';
...
export function configure(aurelia) {
aurelia.use
.plugin('aurelia-validation', (config) => config
.useViewStrategy(TWBootstrapViewStrategy.AppendToInput))
...
}
As an aside, the d.ts
is currently missing the definitions for the strategies so if you're using TypeScript you'll have to cast the strategy to any
:
import { ValidationConfig, TWBootstrapViewStrategy } from 'aurelia-validation';
...
export function configure(aurelia: Aurelia) {
aurelia.use
.plugin('aurelia-validation', (config: ValidationConfig) => config
.useViewStrategy((<any>TWBootstrapViewStrategy).AppendToInput))
...
}
Add
import {ValidateCustomAttributeViewStrategy} from 'aurelia-validation';
to the top of your file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With