Where and when do I set a targetingkey in the Evaluation context if a provider requires one? #1161
-
I'm currently using the OpenFeature Angular SDK with the GoFeatureFlagProvider and it requires a targetingKey to be set on the OpenFeature Context. However, I am unable to find where and when I should do this, as there is no documentation.
Can someone provide some guidance regarding this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Hey @RobertDiebels, you are right, we should add a section for this to the docs. That means, that evaluation context will be set in the code at a central place using: OpenFeature.setContext({targetingKey: "some-key"}); This should happen before the first evaluation in your case, as Go Feature Flag will fail without. Do you need any more specific examples? Or any other suggestions? Also, we could add a parameter to the SDK to receive the context, I will pick that up :) |
Beta Was this translation helpful? Give feedback.
Hey @RobertDiebels,we updated the SDK and the docs to show how setting context is intended: https://github.com/open-feature/js-sdk/tree/main/packages/angular/projects/angular-sdk#setting-evaluation-context
You now have the option to give the evaluation context to the module like shown in the following:
Does that solve your issue?
I also tried to reproduce your issue with injecting the
OpenFeatureModule
at root level but it works for me usingAppli…