Skip to content

NgxFeatureToggleRouteGuard with OR behavior #275

@yl-endress

Description

@yl-endress

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",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions