首页 > 解决方案 > 如何更改角度自定义元素的网址

问题描述

我想更改 Angular 项目中自定义元素的 url,即当前项目正在使用 url http://localhost:4200/#/wb/(some-id)成功运行自定义元素。我的需要是将url改为http://localhost:4200/project,而不改变组件的路由配置。如何做到这一点?

index.html 文件

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Workbench</title><!-- Latest compiled and minified CSS -->
</head>
<body>


      <app-root></app-root>
      <work-bench></work-bench>


  <script type="text/javascript" src="./workbench.js"></script>
 <link rel="stylesheet" href="styles.css"></link>

</body>
</html>

标签: angularangular-elements

解决方案


推荐阅读