Skip to content

When the hashlocationstrategy is turned on, when switching from portal to subapp root, the hash of url will disappear #109

@HsienW

Description

@HsienW

Describe

I am transforming an old project. When dealing with routing, it all uses hashlocationstrategy. I configure the routing according to the planet example, I find when hashlocationstrategy is turned on and route is switched from portal to sub app root, the hash of url will disappear , But when entering the lower page route of sub app, the hash is displayed normally, I don't know what's wrong

To Reproduce

  1. Portal to sub app root
  2. Sub app root to sub app page

Expected behavior

When use hashlocationstrategy routing # always exist.

Screenshots

  1. Routing in the portal home
    image

  2. Routing to sub app1 root
    image

  3. Routing to app1 belong to dashboard page
    image

Package json

{
  "name": "",
  "version": "",
  "scripts": {
    ... Omit
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "8.2.0",
    "@angular/cdk": "8.2.3",
    "@angular/common": "8.2.0",
    "@angular/compiler": "8.2.0",
    "@angular/core": "8.2.0",
    "@angular/forms": "8.2.0",
    "@angular/http": "7.2.15",
    "@angular/platform-browser": "8.2.0",
    "@angular/platform-browser-dynamic": "8.2.0",
    "@angular/router": "8.2.0",
    "@angular/upgrade": "8.2.0",
    "@worktile/planet": "1.1.2",
    "lodash": "4.17.15",
    "rxjs": "6.5.3",
    "zone.js": "0.9.1"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "8.4.1",
    "@angular-builders/dev-server": "7.3.1",
    "@angular-devkit/build-angular": "0.802.2",
    "@angular-devkit/build-ng-packagr": "0.803.20",
    "@angular/cli": "8.2.0",
    "@angular/compiler-cli": "8.2.0",
    "@angular/language-service": "6.0.2",
    "@types/jasmine": "2.5.45",
    "@types/jasminewd2": "2.0.3",
    "@types/node": "6.0.60",
    "codelyzer": "5.0.1",
    "concurrently": "4.1.0",
    "jasmine-core": "2.6.4",
    "jasmine-spec-reporter": "4.1.1",
    "karma": "4.4.1",
    "karma-chrome-launcher": "3.1.0",
    "karma-coverage-istanbul-reporter": "2.1.1",
    "karma-jasmine": "3.1.0",
    "karma-jasmine-html-reporter": "1.5.1",
    "protractor": "5.3.0",
    "ts-node": "5.0.1",
    "tslint": "5.9.1",
    "typescript": "3.5.3",
    "webpack-assets-manifest": "3.1.1"
  }
}

Portal routing module

... Omit import 

const routes: Routes = [
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  },
  {
    path: 'home',
    component: HomeComponent
  },
  {
    path: 'app1',
    component: EmptyComponent,
    children: [
      {
        path: '**',
        component: EmptyComponent
      }
    ]
  },
  {
    path: 'app2',
    component: EmptyComponent,
    children: [
      {
        path: '**',
        component: EmptyComponent
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes,
    {
      paramsInheritanceStrategy: 'always',
      useHash: true // I just open this option additionally
    }
  )],
  exports: [RouterModule]
})
export class AppRoutingModule {
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions