Skip to content

Commit

Permalink
chore(README.md): update setup content
Browse files Browse the repository at this point in the history
  • Loading branch information
willmendesneto committed Jun 13, 2017
1 parent 75c1d9e commit 349001a
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ npm install ngx-feature-toggle --save

# Setup

You'll need to add `FeatureToggleModule` to your application module. So that, the `featureToggle` directive will be accessible in your application.
You'll need to add `FeatureToggleModule` to your application module. So that, the `featureToggle` components will be accessible in your application.

```typescript
@NgModule({
Expand All @@ -70,30 +70,29 @@ Now you just need to add a configuration in your application root component. You
- File information;
- etc;

After that, you can use the `featureToggle` directive in your templates, passing the string based on the feature toggle configuration data.
After that, you can use the `featureToggle` components in your templates, passing the string based on the feature toggle configuration data.

- `feature-toggle-provider`: Handle with feature toggle configuration in your application. It adds the default values of your enabled/disabled features;
- `feature-toggle`: Handle with feature toggle check. So that, the component will be rendered/removed based on the feature toggle provider configuration;

```typescript
import { Component } from '@angular/core';
import { FeatureToggleServiceProvider } from 'ngx-feature-toggle';

@Component({
selector: 'component-docs',
template: `
<h3>Live code</h3>
<p>Feature Toggle Configuration Data: </p>
<p><b>{{ featureToggleData | json }}</b></p>
<feature-toggle [featureName]="'enableSecondText'">
<p>condition is true and "featureToggle" is enabled.</p>
<feature-toggle [featureName]="'enableFirstText'">
<p>condition is false and "featureToggle" is disabled. In that case this content should not be rendered.</p>
</feature-toggle>
<feature-toggle [featureName]="'enableFirstText'" showWhenDisabled >
<p>condition is false and "featureToggle" is disabled and it has "showWhenDisabled" attribute.</p>
<p>In that case this content should be rendered.</p>
<feature-toggle-provider [featureToggleService]="featureToggleData">
<feature-toggle [featureName]="'enableSecondText'">
<p>condition is true and "featureToggle" is enabled.</p>
<feature-toggle [featureName]="'enableFirstText'">
<p>condition is false and "featureToggle" is disabled. In that case this content should not be rendered.</p>
</feature-toggle>
<feature-toggle [featureName]="'enableFirstText'" showWhenDisabled >
<p>condition is false and "featureToggle" is disabled and it has "showWhenDisabled" attribute.</p>
<p>In that case this content should be rendered.</p>
</feature-toggle>
</feature-toggle>
</feature-toggle>
</feature-toggle-provider>
`
})

Expand Down

0 comments on commit 349001a

Please sign in to comment.