Coder Social home page Coder Social logo

willmendesneto / ngx-feature-toggle Goto Github PK

View Code? Open in Web Editor NEW
100.0 3.0 12.0 4.92 MB

Your module to handle with feature toggles in Angular applications easier.

License: MIT License

JavaScript 10.00% TypeScript 85.01% HTML 4.64% CSS 0.16% SCSS 0.19%
feature-toggle ngx-feature-toggle flags angular feature-flags hacktoberfest

ngx-feature-toggle's Issues

Enable "feature toggle in array" in Template (like in Route Guards)

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

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

Current behavior

<ng-container *featureToggle="'TOGGLE_ENABLE_FEATURE_1_OF_2'">
  <ng-container *featureToggle="'TOGGLE_ENABLE_FEATURE_1_OF_2'">
    Show this content when both feature toggles are enabled
  </ng-container>
</ng-container>

Expected behavior

<ng-container
  *featureToggle="[
    'TOGGLE_ENABLE_FEATURE_1_OF_2',
    'TOGGLE_ENABLE_FEATURE_2_OF_2'
  ]"
>
  Show this content when both feature toggles are enabled
</ng-container>

Reproduction of the problem

Not interesting.

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

Check two or more feature toggle once in template (with ! check too), exactly as in Route Guards.

Please tell us about your environment:

Not interesting.

Feature request: Prevent routing to component

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

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

Expected behavior

Prevent routing to component

If access to a component should be prevented when a feature is turned off. This can be accomplished by using the canActivate option available in Angular’s router.

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

I want to load only modules when a feature is turned on.

Request FeatureToogleProvider configurable onLoad module

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

The FeatureToogleProvider is one directive, but we need load map features onLoad of application. The features are valid for all aplication.
Why set list features in HTML?

Please, can you create provider for load on module and, prefer, load rxJS features?

Enable All / Disable All Option

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

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

Current behavior

Now I have to copy paste the whole configuration for all possible environments.

Expected behavior

It would be nice to have an option to enable all features. For example I would develop a service which would return true every time for any feature name if the url of the loaded webpage is localhost. If the url is different the service would return the value for a given feature from the config object. If there is no value for that feature name, the service would return false.

Or I would like to have a button in the application "hide all development features" and after this button is clicked, my service would return false for any features, otherwise it would always return true for all the features. then I do not need the config object at all.

Summary - the API expects a config object always, this is too restrictive.

(maybe I misunderstood th API, if yes , then I am sorry)

Reproduction of the problem

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

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (if applicable): node --version =

NgOnInit called with disabled feature

I'm submitting a ...

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

Current behavior

We're using a feature toggle to show or hide a section in a form. We're implementing OnInit to add the form group in its parent one.

Expected behavior

We would expect that the component's ngOnInit method would not get called at all like it would happen if we used instead a ngIf directive.

Reproduction of the problem

Stackblitz demo

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

The component is not rendered as expected, but nothing related to an inner component life cycle should be called at all.

Please tell us about your environment:

  • OS: Windows 10;
  • IDE: Visual Studio Code;
  • Package manager: npm;
  • HTTP Server: Webpack (ng serve);
  • Browser: Tested on all major browsers available on Windows: Chrome, Firefox, Edge (+ Opera)

  • Language: Typescript

  • Node (if applicable): Probably not applicable, but node --version = 8.11.1

Use a "redirectTo" property in route.data to let guard where redirect when the rule is not matched

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

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

Current behavior

const routes = [
  {
    path: "to/feature/toggle",
    canActivate: [NgxFeatureToggleCanActivateGuard],
    data: {
      featureToggle: ["TOGGLE_ENABLE_FEATURE_1"],
    },
  },
];

Expected behavior

const routes = [
  {
    path: "to/feature/toggle",
    canActivate: [NgxFeatureToggleCanActivateGuard],
    data: {
      featureToggle: ["TOGGLE_ENABLE_FEATURE_1"],
      redirectTo: "to/feature/toggle/not/enabled",
    },
  },
];

Reproduction of the problem

Not interesting.

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

Redirect a user in a specific route when it tries to access in a route with a CanActivate/CanActivateChild/CanLoad Feature Toggle Guard.

Idea Brainstorming:

  • create a new guard only for redirecting or maybe only
  • create a new object property (called featureToggles) to use in data (same behavior extracted from ngx-permissions

Please tell us about your environment:

Not interesting.

Upgrade to Angular 13

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

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

Current behavior

angular 9

Expected behavior

Upgrade to angular 13

No error or log when Feature Toggle Provider data is not having featuretoggle name which is using in sub components

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

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

Current behavior

Expected behavior

If featuretoggle name which is using in sub components is not listed in provider data, either it should notify or it has to generate compile time error. It should not disable the feature.

Reproduction of the problem

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

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (if applicable): node --version =

Uncaught Error: Template parse errors: Can't bind to 'featureToggleService' since it isn't a known property of 'feature-toggle-provider'

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

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

Current behavior

Uncaught Error: Template parse errors:
Can't bind to 'featureToggleService' since it isn't a known property of 'feature-toggle-provider'

Expected behavior

Should hide a button when feature-toggle is false

Reproduction of the problem

Just follow https://github.com/willmendesneto/ngx-feature-toggle/blob/master/README.md .
use ngx-feature-toggle(4.0.0)
What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Operating system: Ubuntu 14.04

  • Browser: [ Chrome 58 ]
  • Language: [TypeScript 2.3.4, angular 4]

  • Node (if applicable): node --version = v6.10.0
    npm --version = 3.10.10

Migrating from Travis-CI to Circle-CI

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

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

Current behavior
Currently we are using Travis-CI for our automated checks, but it's not flexible. After investigate some options Circle-CI is a good one for some reasons:

  • The configurations are based in a YAML file, which is easy to change;
  • It has a Workflow concept, which is similar to Build Pipelines approach. We can have some benefitis in this approach, such as run tasks in parallel;
  • It can run using a Docker image as base environment, which can give us more flexibility;

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Replaced the old Node.js version in your .nvmrc with the new one
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

FeatureToggleProvider does not work with RxJS

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
Nothing! The FeatureToggleProvider ignore featureToggleService=RxJS (subscribe)

Expected behavior
Listening RxJS (subscribe) and use data response.

Reproduction of the problem

Partial HTML

                <feature-toggle-provider [featureToggleService]="featureService.getAllFeatures()"></feature-toggle-provider>
                <feature-toggle [featureName]="'categoria'">
                  <button type="button" class="btn btn-danger btn-sm" (click)="excluirCategoria(categoria)">
                    <i class="fa fa-remove"></i>
                  </button>
              </feature-toggle>

MyComponent and MyService (RxJS)

export class CategoriaHomeComponent implements OnInit {
    constructor(private featureService: FeatureService) {            }
...
}

export class FeatureService {

  constructor(private http: HttpClient) {
  }

  public getAllFeatures(): Observable<any> {
    return this.http.get<any>(API_URL + '/features');
  }

  public get(key: String): Observable<Boolean> {
    return this.http.get<Boolean>(API_URL + '/features/' + key);
  }
}

NgxFeatureToggleRouteGuard with OR behavior

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

An in-range update of @angular/material is breaking the build 🚨

Version 2.0.0-beta.8 of @angular/material just got published.

Branch Build failing 🚨
Dependency @angular/material
Current Version 2.0.0-beta.7
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @angular/material is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes plasma-abacus

Highlights

  • This version marks the release of @angular/cdk (component dev kit)! This package contains
    general building blocks for UI components decoupled from the visuals of Material Design. In the
    initial release, code from Angular Material's core/ have been moved for a11y/, bidi/,
    coercion/, observe-content/, platform/, portal/. The @angular/material package now
    re-exports these symbols, marked as deprecated. The re-exports will be removed in a subsequent
    release.
  • Initial version of data-table component. There is both a <cdk-table> (the core) and the
    <md-table> (with Material Design styles). See the documentation on material.angular.io for more
    information.
  • Initial version of <md-paginator> and <md-sort-header> components, which can be used either
    with <md-table> or any other table.
  • Both @angular/material and @angular/cdk are now strict null compliant.

Breaking changes

  • @angular/material now depends on @angular/cdk as a peer dependency.
  • Some types have expanded to include | null or | undefined for strict null compatibility. If
    your application uses strict null checks, you may have to update the types in your app to match up
    with the more accurate types coming from Angular Material.
  • Angular Material no longer adds RxJS operators to the prototype of Observable. If your app
    depended on these operators being added by Angular Material, you will need to import them
    explicitly.

Bug Fixes

  • autocomplete: allow number zero as value (#5364) (9137fd9), closes #5363
  • autocomplete: don't scroll panel when option is visible (#4905) (d3af57d)
  • autocomplete: not closing when tapping away on mobile (#5260) (1dcaca7)
  • autocomplete: reopening when clicking an option in IE (#5172) (fe31210), closes #5165
  • autosize: resize when form value changes. Fixes #4657 (#5315) (8c9c11a)
  • button-toggle: fix standalone button toggle style (#5121) (3d8c833)
  • datepicker: pass layout direction to touchUi dialog (#5052) (8b6efb1)
  • datepicker: use theme foreground color (#5290) (51bf26e)
  • dialog: set aria-labelledby based on the md-dialog-title (#5178) (aee984a)
  • directionality: error on platform-server (#5234) (49dfe60)
  • input: theming mixin error (#5254) (37efb54), closes #5232
  • input: underline showing at end if text-align is set (#5280) (5c9391d), closes #5272
  • memory: Unsubscribe event listeners when using Observable.fromEvent (#5325) (1b351cd)
  • menu: role being set on the wrong element (#5191) (2239668)
  • overlay: remove webkit tap highlight from backdrop (#5258) (8feddd4)
  • select: align first option to trigger when it is inside a group (#5153) (d39cb12)
  • select: expose focus method (#5255) (7b2d4ae), closes #5251
  • select: md-optgroup not using typography styles (#5193) (b5bf6f5)
  • select: page scrolling down when selecting option with space (#5192) (2361385)
  • snackbar: clear timeout upon dismiss (#4860) (146160c)
  • tabs: server-side rendering error (#5348) (0174377)
  • unique-selection-dispatcher: remove listeners on destroy (#5164) (f9bbbe7)

Features

  • data-table: initial version. Too many commits to list.
  • directionality: a provider to get directionality (#4044) (61d979e), closes #3600
  • input: add custom error state matcher (#4750) (f73cc97)
  • pagination: initial pagination component (#5156) (85fb00a)
  • sort: add ability to manage and display sorting (#5307) (b328d36)
  • tab-nav-bar: support disabling tab links (#5257) (fc809ed), closes #5208
  • add support for strict null checks (#5094) (2bf7024)
  • remove uses of rxjs patch operators (#5314) (e488e3f), closes #2622
  • move a11y, bidi, platform, rxjs, and portal to cdk (#5386) (fde35e4)
  • move observe-content to cdk (#5438) (b00f838)
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Implement ability to monitor the value of feature x to show / hide dynamically

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

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

Current behavior
n/a

Expected behavior
n/a

Reproduction of the problem
n/a

What is the motivation / use case for changing the behavior?
It would be nice if the toggle states were monitored and the element could show/hide depending on that state.

i.e element x is visible, API call goes off and returns a 503, then element x is not visible

Please tell us about your environment:
n/a

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    n/a

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (if applicable): node --version =

Redirect Doesn't Work When Path is Empty

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.