Error w/ Validation Au2

Having issues with running simple validation rule examples on a component in au2.

A very basic component form page below that is routed from a router.

import { bindable, Params, IRouter, IRouteViewModel } from 'aurelia';
import { IValidationRules } from '@aurelia/validation';
import { IValidationController } from '@aurelia/validation-html';
import { newInstanceForScope } from '@aurelia/kernel';
import template from './contact-form.html';


class Contact {
    public constructor(
       public name: string,
       public email: string,
       public message: string
    ){}
}

export class ContactForm implements IRouteViewModel {
    private contact: Contact;
    
    public constructor (
        @newInstanceForScope(IValidationController) private controller: IValidationController,
        @IValidationRules private validationRules: IValidationRules
    )
    {
        this.contact = new Contact(undefined, undefined, undefined);
       
        validationRules
          .on(this.contact)
          .ensure('name')
            .required();
    }

    public async submit(){
        //const result = await this.validationController.validate();
        //console.log(result);
    }
}

When you flip to the page you get the error:

Uncaught (in promise) Error: AUR0012:IPlatform
    at Container.R (index.js?8966:1047:1)
    at Container.get (index.js?8966:929:1)
    at Container.at (index.js?8966:759:1)
    at Array.map (<anonymous>)
    at Container.invoke (index.js?8966:961:1)
    at ValidationControllerFactory.construct (index.mjs?c5e3:276:1)
    at ct (index.js?8966:682:1)
    at eval (index.js?8966:673:1)
    at n.resolve (index.js?8966:613:1)
    at Container.get (index.js?8966:921:1)

Any ideas? I tried various constructor arguments. I followed the au2 docs to install and register “ValidationHtmlConfiguration” with defaults. Maybe I’m misunderstanding something because I’m much more used to ES/js.

Same as
https://discourse.aurelia.io/t/using-interfaces-in-di-broken-in-2-0-0-alpha-30/4763/4

update to alpha.33

1 Like

@ArchEnemy It seems to be working. Check this SB example: au2-validation-with-router - StackBlitz

1 Like

Thank you so much. I didn’t realize what the issue was. Descriptive errors are so hard to interpret for some of us and the complexity of the documentation is getting to a level where “there’s many ways to do things, but which is the right way and where are the examples that don’t exactly match the one example that was done in the docs”…

Greatly appreciate the fast response. Everything is starting to work great!

1 Like

Thanks! I did forget to mention I was on alpha .24