Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have created an angular project and then prepared it to run on hosts with the ng build command. My problem is with the url, I have a # created at the end of my server or local address, how do I remove this mark?

Exam:

http://localhost:4200/#/ Convert to http: // localhost: 4200

app.routing.ts:

const routes: Routes = [
  {
    path: '', component: HomeComponent
  },
  {
    path: 'AdminUni', component: AdminUniComponent, canActivate: [ValidTokenRoutingGuard], children: [
      { path: '', component: EvalActivationComponent },
      { path: 'EvalActivation', component: EvalActivationComponent },
      { path: 'Users', component: UserUniComponent },
      { path: 'EduGroup', component: EduGroupUniComponent },
      { path: 'TeachingQuality', component: TeachingQualityUsersComponent },
    ]
  },
  {
    path: 'Admin', component: MainAdminComponent, children: [
      { path: '', component: UsersComponent },
      { path: 'user', component: UsersComponent },
      { path: 'university', component: UniversityComponent },
      { path: 'state', component: StateComponent },
      { path: 'noticed', component: NoticedAdminComponent },
      { path: 'rules', component: RulesComponent },
    ]
  },
  {
    path: 'User', component: PanelUsersComponent, canActivate: [ValidTokenRoutingGuard], children: [
      { path: '', component: UserInfoComponent },
      { path: 'EvalActivation', component: EvalActivationUserComponent },
      { path: 'Information', component: UserInfoComponent },
    ]
  },
  {
    path: 'groupManager', component: GroupManagerComponent, canActivate: [ValidTokenRoutingGuard], children: [
      { path: '', component: DeptDirectorComponent },
      { path: 'WaitingConfirmation', component: DeptDirectorComponent },
      { path: 'Evaluated', component: OpinionsDeptDirectorComponent },
    ]
  },
  {
    path: 'uniPresident', component: UniPresidentComponent, canActivate: [ValidTokenRoutingGuard], children: [
      { path: '', component: UniPresidentFormComponent },
      { path: 'WaitingConfirmation', component: UniPresidentFormComponent },
      { path: 'Evaluated', component: OpinionsUniPresidentComponent },
    ]
  },
  {
    path: 'committee', component: PromotionsCommitteeComponent, canActivate: [ValidTokenRoutingGuard], children: [
      { path: '', component: PromotionsCommitteeFormComponent },
      { path: 'WaitingConfirmation', component: PromotionsCommitteeFormComponent },
      { path: 'Evaluated', component: OpinionsCommitteeComponent },
      { path: 'ParticipateVoting', component: GetNeedVotesComponent },
      { path: 'MyTheories', component: CommitteeMemberComponent },
    ]
  },
  {
    path: 'Account/ResetPassword', component: ResetPasswordComponent
  },
  {
    path: '**', component: PageNotFoundComponent
  }
];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
380 views
Welcome To Ask or Share your Answers For Others

1 Answer

I suppose you are using useHash property when you are registering your routes.

RouterModule.forRoot(routes, { useHash: false })

you can make it false or remove it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...