首页 > 解决方案 > 未捕获的 SyntaxError:标识符“API_PUBLIC_KEY”已被声明

问题描述

将路由添加到我的 app-routing.module.ts 后,每当我使用 routerLink 时,例如

<a class="button" routerLink = "/">Home</a>

我在控制台中收到此消息:

Uncaught SyntaxError: Identifier 'API_PUBLIC_KEY' has already been declared // VM2601 layout.js:1

在 VM2601 layout.js:1 里面这一行被标记为问题

const API_PUBLIC_KEY = "xxxxxxxxx";”(其中 xxxxxxxxx 是出于隐私原因我用 xs 替换的密钥)。

请注意,此错误不会影响我的应用程序功能。我只是想了解导致它的原因,它的严重程度以及解决方法。

标签: angular

解决方案


推荐阅读