Aurelia checkout configuration

I am trying to configure Aurelia Validation (0.2.6 release) to get all validation messages added to an item <input>

instead of a 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 always get the following error:

Rejecting an unhandled promise ReferenceError: ValidateCustomAttributeViewStrategy is undefined

What am I doing wrong?

+3


source to share


3 answers


Add    import {ValidateCustomAttributeViewStrategy} from 'aurelia-validation';

at the top of your file



+2


source


This seems to have changed quite recently . 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, d.ts

there are currently no definitions for strategies , so if you are using TypeScript you will need to cast the strategy before any

:

import { ValidationConfig, TWBootstrapViewStrategy } from 'aurelia-validation';
...

export function configure(aurelia: Aurelia) {
    aurelia.use
        .plugin('aurelia-validation', (config: ValidationConfig) => config
            .useViewStrategy((<any>TWBootstrapViewStrategy).AppendToInput))
        ...
}

      

+7


source


To check the version of aurelia version 1.0. He works with building a custom renderer. See. Here in section custom renderer.

0


source







All Articles