ngx-feature-toggle-demo
Version:
Your module to handle with feature toggles in Angular applications easier.
30 lines (27 loc) • 880 B
text/typescript
import { Component, NgZone } from '@angular/core';
({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
export class HomeComponent {
featureToggleData: any = {
enableFirstText: false,
enableSecondText: true,
};
constructor(private zone: NgZone) {
// Required because Protractor current behavior
// More details in https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular
this.zone.runOutsideAngular(() => {
setInterval(() => {
this.zone.run(() => {
Object.keys(this.featureToggleData).map(
key => (this.featureToggleData[key] = !this.featureToggleData[key]),
);
});
// increase/decrease this number to see the
// current feature toggle component behavior
}, 5000);
});
}
}