You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add feature flag service for angular (#1247)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
NOTE: This is still a draft for discussion!
## This PR
<!-- add the description of the PR here -->
Adds a service for evaluating flags in angular services.
It enables application authors to evaluate flags directly as observables
or signal.
~~I am not 100% sure about returning signals or leaving the `toSignal`
to the application autors.
As far as I understand, when used like the following, subscriptions for
`toSignal` will still be cleaned up correctly, as the injection context
will be captured correctly in that case:~~
```js
@component({
template: `
<div data-testid="value">{{ thumbs()?.value ? '👍' : '👎' }}</div>
<div data-testid="reason">reason: {{ thumbs()?.reason }}</div>
`,
standalone: true,
})
class TestSignalComponent {
private flagService = inject(FeatureFlagService);
thumbs = this.flagService.getBooleanDetailsSignal(FLAG_KEY, false);
}
```
Edit: We decided to leave the `toSignal` to the app authors.
@juanparadox please leave feedback.
I still have to clean up the tests and the code in general, if we decide
this is the design we opt for.
---------
Signed-off-by: Lukas Reining <[email protected]>
0 commit comments