Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Angular 2“在遇到静态解析符号值时出错.”运行i18n大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试运行i18n提取工具来翻译我的角度2应用程序.
但是当我试图跑步时,我得到:

Failed on type {"filePath":"C:/ng/anbud/src/app/_common/logging-error handler.ts","name":"LoggingErrorHandler"} with error Error: Error encountered resolving symbol values statically. Could
 not resolve type LoggingErrorHandlerOptions (position 34:53 in the original .ts filE),resolving symbol LoggingErrorHandler in C:/ng/anbud/src/app/_common/logging-error-handler.ts
Error: Error encountered resolving symbol values statically. Could not resolve type LoggingErrorHandlerOptions (position 34:53 in the original .ts filE),resolving symbol LoggingErrorHandle
r in C:/ng/anbud/src/app/_common/logging-error-handler.ts
    at simplifyInContext (C:\ng\anbud\node_modules\@angular\compiler-cli\src\static_reflector.js:469:23)
    at StaticReflector.simplify (C:\ng\anbud\node_modules\@angular\compiler-cli\src\static_reflector.js:472:22)
    at StaticReflector.parameters (C:\ng\anbud\node_modules\@angular\compiler-cli\src\static_reflector.js:102:47)
    at CompileMetadataResolver.getDependenciesMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14317:56)
    at CompileMetadataResolver.getTypeMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14282:28)
    at CompileMetadataResolver.getProviderMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14473:42)
    at C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14421:47
    at Array.forEach (nativE)
    at CompileMetadataResolver.getProvidersMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14405:21)
    at C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14412:43
Extraction Failed

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\js\\ApPDAta\\roaR_81_11845@ing\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "i18n"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! beskrivelse@0.1.0 i18n: `ng-xi18n`
npm ERR! Exit status 1

错误发生在我的自定义错误处理程序中:

// Import the core angular services.
import { ErrorHandler } from '@angular/core';
// import { forWARDRef } from '@angular/core';
import { Inject } from '@angular/core';
import { Injectable } from '@angular/core';

// Import the application components and services.
import { ErrorLogservice } from './error-log.service';

export interface LoggingErrorHandlerOptions {
  rethrowError: Boolean;
  unwrapError: Boolean;
}

export var LOGGING_ERROR_HANDLER_OPTIONS: LoggingErrorHandlerOptions = {
  rethrowError: false,unwrapError: false
};

@Injectable()
export class LoggingErrorHandler implements ErrorHandler {

  private errorLogservice: ErrorLogservice;
  private options: LoggingErrorHandlerOptions;

  constructor(
    errorLogservice: ErrorLogservice,@Inject(LOGGING_ERROR_HANDLER_OPTIONS) options: LoggingErrorHandlerOptions <!--- ERROR
  ) {
    this.errorLogservice = errorLogservice;
    this.options = options;
  }

错误处理程序基于以下文章
https://www.bennadel.com/blog/3138-creating-a-custom-errorhandler-in-angular-2-rc-6.htm

因此,如果您想要查看完整的代码,您可以在那里看到它.

任何人都知道为什么会抛出这个错误

@H_607_23@解决方法
这里只是一个疯狂的猜测:

更改

export interface LoggingErrorHandlerOptions

export class LoggingErrorHandlerOptions

大佬总结

以上是大佬教程为你收集整理的Angular 2“在遇到静态解析符号值时出错.”运行i18n全部内容,希望文章能够帮你解决Angular 2“在遇到静态解析符号值时出错.”运行i18n所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。