[英]Can not define service. Factory is missing the following properties from type is missing the following properties from type 'TypeProvider'
我正在将表单验证器注入服务中。 我从文章中得到以下代码
/**
* Error formaters.
*/
export const defaultErrors = {
required: (error: any): string => `This field is required.`,
minlength: ({requiredLength, actualLength}): string => {
return `Expect ${requiredLength} but got ${actualLength}`;
}
};
/**
* Error formaters injected.
*/
export const FORM_ERRORS = new InjectionToken('FORM_ERRORS', {
// providedIn: 'root',
factory: () => defaultErrors
});
它会产生错误。
is missing the following properties from type 'TypeProvider': apply, call, bind, prototype, and 5 more.
我知道我需要仔细阅读文档......它仍然没有得到解决。
对不起,这个问题很幼稚。 我这样注入。
@inject(FORM_ERRORS) private errors,
权利是资本I.
@Inject(FORM_ERRORS) private errors,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.