import {Router, RouterConfiguration} from 'aurelia-router'
import {I18N} from 'aurelia-i18n';
import {autoinject} from 'aurelia-framework';
import { ValidationConfig } from 'aurelia-validation';
@autoinject
export class App {
router: Router;
i18n: I18N;
constructor(i18n: I18N,validationConfig:ValidationConfig) {
this.i18n = i18n;
}
不起作用。 我得到了:
aurelia-pal.js:38 Uncaught(in promise)错误:调用undefined时出错。检查>细节的内部错误。
内部错误: 消息:类型不是构造函数 内部错误堆栈: TypeError:Type不是构造函数 at Object.invoke(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:323:14) 在InvocationHandler.invoke(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:300:168) 在Container.invoke(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:564:25) 在StrategyResolver.get(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:127:37) 在Container.get(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:501:23) at Object.invoke(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:335:57) 在InvocationHandler.invoke(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:300:168) 在Container.invoke(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:564:25) 在StrategyResolver.get(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:127:37) 在Container.get(http://localhost:9000/jspm_packages/npm/aurelia-dependency-injection@1.0.0-beta.1.2.2/aurelia-dependency-injection.js:501:23)
如果删除对ValidationConfig的依赖,我没有错误。
我正在使用I18n,并希望在全局区域设置更改时设置验证的本地。
插件的初始化如下:
.plugin('aurelia-validation', (config:ValidationConfig) => {
config
.useLocale('en-US')
.useViewStrategy((<any>TWBootstrapViewStrategy).AppendToInput);
})
我正在使用: “aurelia-pal”:“npm:aurelia-pal@1.0.0-beta.1.2.1” “aurelia-validation”:“npm:aurelia-validation@0.6.8”
答案 0 :(得分:0)
ValidationConfig已被删除,因此解决了此错误。