Skip to content

Commit

Permalink
Merge pull request #78 from cah-danmonroe/danmonroe
Browse files Browse the repository at this point in the history
Add example of setting flags from a fetch in the README
  • Loading branch information
kategengler authored Sep 28, 2018
2 parents 87f0b7b + 3523000 commit 93113e7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ this.get('features').setup({
"new-homepage": false
});
```

You may want to set the flags based on the result of a fetch:

```js
// routes/application.js
features: inject(),
beforeModel() {
return fetch('/my-flag/api').then((data) => {
features.setup(data.json());
});
}
```

*NOTE:* `setup` methods reset previously setup flags and their state.

You can get list of known feature flags via `flags` computed property:
Expand Down

0 comments on commit 93113e7

Please sign in to comment.