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

Redirect Doesn't Work When Path is Empty #268

Closed
1 task
brandonsmith86 opened this issue Feb 28, 2023 · 2 comments
Closed
1 task

Redirect Doesn't Work When Path is Empty #268

brandonsmith86 opened this issue Feb 28, 2023 · 2 comments

Comments

@brandonsmith86
Copy link
Contributor

I'm submitting a ... (check one with "x")

  • [ x] bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

When you configure home page to have path = '', and use NgxFeatureToggleRouteGuard with redirectTo = '', redirect does not happen.

Expected behavior

Redirect to route where path = ''.

Reproduction of the problem

Use this snippet in your app routing module:

const ROUTE_DATA = {
  redirectTo: '', // home page
  featureToggle: [
    'FlagName'
  ]
};

const ROUTES: Routes = [
  { 
    path: '',
    component: HomePageComponent,
    pathMatch: "full"
  },
  { 
    path: 'Guard',
    component: GuardedComponent,
    canActivate: [NgxFeatureToggleRouteGuard],
    data: ROUTE_DATA
  }
];

What is the motivation / use case for changing the behavior?

Many apps set their home page with path = ''. This limitation prevents that design.

Please tell us about your environment:
OS: Windows
IDE: VS Code
NPM: 9.4.2
Browser: Chrome v110
Language: Typescript ES6
Node: 18.14.0

@brandonsmith86
Copy link
Contributor Author

I attempted to push a fix with additional tests but don't have permission to do so.

@willmendesneto
Copy link
Owner

Hey @brandonsmith86 , thanks for raising this issue and the proactivity to apply the required changes!

You might need to fork this project, apply the changes and open a pull request in this repository with your changes.

Please let me know if you need any assistance in any sense. I can see you're keen to get that done and I believe that's the spirit, so count me in to support you in any sense! 🎉

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