Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 读取清单中的内容_Javascript_Angular_Progressive Web Apps - Fatal编程技术网

Javascript 读取清单中的内容

Javascript 读取清单中的内容,javascript,angular,progressive-web-apps,Javascript,Angular,Progressive Web Apps,我正在使用angular创建一个项目。我正在尝试使用angular progressive web应用程序的功能。该应用程序运行完美。现在我想了解一种情况,我需要从清单文件中读取值,但我不知道如何实现这一点 { "name": "xxxxx", "short_name": "xxxxxx", "theme_color": "xxx", "background_color": "xxx", "display": "standalone", "scope": "./",

我正在使用angular创建一个项目。我正在尝试使用angular progressive web应用程序的功能。该应用程序运行完美。现在我想了解一种情况,我需要从清单文件中读取值,但我不知道如何实现这一点

{
  "name": "xxxxx",
  "short_name": "xxxxxx",
  "theme_color": "xxx",
  "background_color": "xxx",
  "display": "standalone",
  "scope": "./",
  "start_url": "./index.htm",
  "icons": [
    {
      "src": "assets/images/xxxx.png",
      "sizes": "76x76",
      "type": "image/png"
    },
    {
      "src": "assets/images/xxxx.png",
      "sizes": "120x120",
      "type": "image/png"
    },
    {
      "src": "assets/images/xxx.png",
      "sizes": "128x128",
      "type": "image/png"
    },
    {
      "src": "assets/images/xx.png",
      "sizes": "152x152",
      "type": "image/png"
    },
    {
      "src": "assets/images/xxx.png",
      "sizes": "168x168",
      "type": "image/png"
    },
    {
      "src": "assets/images/xxxx.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "assets/images/xx.png",
      "sizes": "640x640",
      "type": "image/png"
    }
  ]
}
您可以在(应用程序)组件中执行此操作:

  constructor(
      private readonly httpClient : HttpClient
    ) {
      this.httpClient
        .get<any>('manifest.webmanifest')
        .subscribe( o => {
             console.info(o);
         });
构造函数(
私有只读httpClient:httpClient
) {
这个是.httpClient
.得到