Javascript 未按组件返回中的类名定义角度反射

Javascript 未按组件返回中的类名定义角度反射,javascript,angular,typescript,Javascript,Angular,Typescript,我有很多类,它们有一个映射和一个从键返回映射值的函数 像这样: export abstract class EntityMap1 { private static _items = new Map<string, string>([ ['PARAM1', 'VAL1'], ['PARAM2', 'VAL2'], ['PARAM3', 'VAL3'] ]); static value(key: string): string { retur

我有很多类,它们有一个映射和一个从键返回映射值的函数

像这样:

export abstract class EntityMap1 {
  private static _items = new Map<string, string>([
    ['PARAM1', 'VAL1'],
    ['PARAM2', 'VAL2'],
    ['PARAM3', 'VAL3']
  ]);

  static value(key: string): string {
    return this._items.get(key);
  }
}
{{ getValue('EntityMap1', 'PARAM1') }}
{{ getValue('EntityMap2', 'KEY1') }}
  getValue(enumName: string, key: string) {
    return eval(enumName).value(key);
  }
组件上有此选项:

export abstract class EntityMap1 {
  private static _items = new Map<string, string>([
    ['PARAM1', 'VAL1'],
    ['PARAM2', 'VAL2'],
    ['PARAM3', 'VAL3']
  ]);

  static value(key: string): string {
    return this._items.get(key);
  }
}
{{ getValue('EntityMap1', 'PARAM1') }}
{{ getValue('EntityMap2', 'KEY1') }}
  getValue(enumName: string, key: string) {
    return eval(enumName).value(key);
  }
但结果是:错误:EntityMap1未定义(即使在导入类时)

PS:我不会对每个实体值使用一个函数,因为其中有很多

以下是一个运行示例:

有人有解决方案或建议吗