Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HsienW opened this issue Jul 1, 2020 · 0 comments
Assignees

Comments

@HsienW
Copy link

HsienW commented Jul 1, 2020

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 {
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants