Javascript aurelia validatejs:@required decorator不是';不工作,流利的语法是';我不能自动运行

Javascript aurelia validatejs:@required decorator不是';不工作,流利的语法是';我不能自动运行,javascript,aurelia,Javascript,Aurelia,我设置了如下验证: _setValidation() { this._validator = new Validator(this.model) .ensure("city") .required() .length({ minimum: 5, maximum: 200 }) .ensure("emailAddress") .required() .email(

我设置了如下验证:

_setValidation() {
    this._validator = new Validator(this.model)
        .ensure("city")
            .required()
            .length({ minimum: 5, maximum: 200 })
        .ensure("emailAddress")
            .required()
            .email();

    // for some reason reporter cannot be named _reporter...
    this.reporter = ValidationEngine.getValidationReporter(this.model);
    this._subscriber = this.reporter.subscribe(result => this._renderErrors(result));
}

_renderErrors(result) {
    this.validationErrors.splice(0, this.validationErrors.length);

    result.forEach(error => {
        this.validationErrors.push(error);
    });
}
<form class="bordered" submit.delegate="searchRestaurants()">
    <div class="form-group row">
        <div class="col-xs-2 text-right">
            <label for="email" class="form-control-label">Email address</label>
        </div>
        <div class="col-xs-5">
            <input type="text" class="form-control" id="email" placeholder="Enter email" value.bind="model.emailAddress & validate" />
        </div>
        <div class="col-xs-5">
            <small class="text-muted">We'll never share your email with anyone else.</small>
            <br />
            <small class="text-muted">Entered email will be used later on to confirm reservation.</small>
        </div>
    </div>
    <div class="form-group row">
        <div class="col-xs-2 text-right">
            <label for="city" class="form-control-label">City</label>
        </div>
        <div class="col-xs-5">
            <input type="text" class="form-control" id="city" placeholder="City in which you are looking for a restaurant" value.bind="model.city & validate" />
        </div>
        <div class="col-xs-3">
            <input type="submit" class="btn btn-info" value="Search for restaurants!" />
        </div>
    </div>
</form>
视图如下所示:

_setValidation() {
    this._validator = new Validator(this.model)
        .ensure("city")
            .required()
            .length({ minimum: 5, maximum: 200 })
        .ensure("emailAddress")
            .required()
            .email();

    // for some reason reporter cannot be named _reporter...
    this.reporter = ValidationEngine.getValidationReporter(this.model);
    this._subscriber = this.reporter.subscribe(result => this._renderErrors(result));
}

_renderErrors(result) {
    this.validationErrors.splice(0, this.validationErrors.length);

    result.forEach(error => {
        this.validationErrors.push(error);
    });
}
<form class="bordered" submit.delegate="searchRestaurants()">
    <div class="form-group row">
        <div class="col-xs-2 text-right">
            <label for="email" class="form-control-label">Email address</label>
        </div>
        <div class="col-xs-5">
            <input type="text" class="form-control" id="email" placeholder="Enter email" value.bind="model.emailAddress & validate" />
        </div>
        <div class="col-xs-5">
            <small class="text-muted">We'll never share your email with anyone else.</small>
            <br />
            <small class="text-muted">Entered email will be used later on to confirm reservation.</small>
        </div>
    </div>
    <div class="form-group row">
        <div class="col-xs-2 text-right">
            <label for="city" class="form-control-label">City</label>
        </div>
        <div class="col-xs-5">
            <input type="text" class="form-control" id="city" placeholder="City in which you are looking for a restaurant" value.bind="model.city & validate" />
        </div>
        <div class="col-xs-3">
            <input type="submit" class="btn btn-info" value="Search for restaurants!" />
        </div>
    </div>
</form>
然而,在这种情况下还有另一个问题,
@required
验证器没有运行(永远!)。 要使这两种方法中的任何一种有效,我可以做些什么

另外,我正在使用0.3.0版的aurelia validatejs插件

编辑:


我更新了插件到最新版本(0.4.0),但它仍然有一些错误。。。好像是不稳定的AF!:)因此,现在这个问题的目的发生了变化——你们中有人知道其他aurelia验证插件吗?

所需的问题是一个bug和一个短期修复,我怀疑fluent也缺乏自动更新,只是不确定这个问题。。。