How did the routing address change after angular6 packaged the code?

Let"s talk about the project briefly first

  1. use the angular6.x version
  2. use official cli scaffolding
  3. before and after separation, the angular module invokes the api,node of node and invokes the service of the backend
  4. the packaged dist directory of angular is placed in the static resource directory of node
  5. node uses koa as the framework, accompanied by koa-static,koa-router,koa-views

the code is as follows

/*
* node 
* ejs
*/
// router
router.prefix("/node")
router.get("/index", async (ctx, next) => {
  await ctx.render("index.ejs", {})
  // angular
  // angular
  // angualrindex.htmlindex.ejsjs
});
// routerapp.js

// angular app-routing.module.ts
@NgModule({
  imports: [RouterModule.forRoot(routes, { useHash: true})], // hash URL
  // imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
// app :
loadChildren: "./pages/aaa/aaa.module-sharpaaa"

when I pack up, I will get this page by visiting xxxxx:3001/node/index. The questions are as follows

// 
// http://localhost:3001/-sharp/store/home
// 404 nodeurl

is there any way to prevent angular from modifying the url address, such as the access address:

http://localhost:3001/node/index/-sharp/store/home
// angualrurl-sharp
// cli ng build --prod

because there is no real jump on the page in hash routing mode, why is the url http://localhost:3001/-sharp/store/home after entering? shouldn"t it be http://localhost:3001/node/index/-sharp/store/home

?

try putting

in index.html
<base href="/">
Change

to

<script>
    document.write('<base href="' + document.location + '" />');
</script>
Menu