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

NgxFeatureToggleRouteGuard with OR behavior #275

Open
1 of 2 tasks
yl-endress opened this issue Mar 29, 2023 · 0 comments
Open
1 of 2 tasks

NgxFeatureToggleRouteGuard with OR behavior #275

yl-endress opened this issue Mar 29, 2023 · 0 comments

Comments

@yl-endress
Copy link

yl-endress commented Mar 29, 2023

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

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

Current behavior
Currently, all given feature toggles must be fulfilled. I'd like to have the option if any of the feature properties is fulfilled.

Currently, the AND behavior enforces to deactivate all not required features, like the following:

export const MY_ROUTE: Route = {
  path: "my",
  canActivate: [NgxFeatureToggleRouteGuard],
  loadChildren: () => import(/* webpackChunkName: "my-chunk" */ "./../components/my/my.module").then(lazyModule => lazyModule.MyModule),
  data: {
    featureToggle: [
      "!C", "!D"
    ]
  }
};

As the list of feature toggle grows, this list must be touched again to exclude new feature-toggle (f.e. "!E").
=> I suggest to support besides the AND behavior also the OR behavior

Expected behavior

I'd like to have a featureOrToggle like this:

export const MY_ROUTE: Route = {
  path: "my",
  canActivate: [NgxFeatureToggleRouteGuard],
  loadChildren: () => import(/* webpackChunkName: "my-chunk" */ "./../components/my/my.module").then(lazyModule => lazyModule.MyModule),
  data: {
    featureToggleOr: [
      "A", "B"
    ]
  }
};

Reproduction of the problem

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

Avoid code changes in feature -> it's not mandatory to exclude further features

Please tell us about your environment:

  • Currently, we are using "ngx-feature-toggle": "11.0.0",
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

1 participant