我想将 JSON 文件的值重命名为 angular 中 key/value 的可读文本 2+

I want to rename value of JSON File to readable Text with key/value in angular 2+

我有一个 data-table 和一些数据,点击任何一行我们得到一些详细信息,详细信息来自 JSON 文件,我想用键重命名值价值。因为数据看起来像 "some_information" 而我想显示像 "Some information"

这样的东西

我想我可以在子组件中使用 map,或者在子 html 文件中使用 ngSwitch Loop。但它不起作用。

Working Stuff here

在分配 dataSource 之前,您可以执行以下操作来修改 name 值:

ELEMENT_DATA.forEach(el => {
  // first we replace any '_' with an empty space
  // then we capitalize each first letter of `name` words.
  let modifiedName = el.name.replace(/\_/g, ' ');
  modifiedName = modifiedName.charAt(0).toUpperCase() + modifiedName.slice(1);
  el.name = modifiedName;
})