【发布时间】:2017-05-22 04:29:38
【问题描述】:
请帮助我ensureForEach,我找不到那个点的文件。我有一堂课:
export class EnterReplacements {
replacements: Replacement[] = null;
constructor(
private router: Router,
private eventAggregator: EventAggregator,
private repoCreator: RepoCreator,
protected validation: Validation
) {
this.validation = validation.on(this)
.ensureForEach('replacements')
.ensure('value')
.isNotEmpty()
.etc(); // repeat all the same stuff as in the Item validation
}
}
运行时出错:
ERROR [app-router] Error: Error instantiating EnterReplacements. Check the inner error for details.
这是我的html:
<div class="col-xs-12 col-sm-6 col-lg-4" repeat.for="replacement of replacements">
<input class="string-input" type="text" value.bind="replacement.value" placeholder.bind="replacement.friendlyName" change.delegate="$parent.onChanged()"/>
</div>
我需要验证 replacements 数组中项目的所有 value 属性不为空。请帮忙!!!
【问题讨论】:
-
只是我们的好奇心。你从哪里得到 .ensureForEach ?我只能在讨论可能实现的票证中找到参考。但就我所见,它还没有。 github.com/aurelia/validation/issues/10
-
没错,没有 ensureForEach
-
我们还有其他方法来验证数组中的项目吗?
标签: validation typescript aurelia