import{DatadogProvider}from'@datadog/openfeature-browser';constprovider=newDatadogProvider({// Required
// applicationId is a unique identifier to distinguish multiple frontend applications.
// This should match the app ID you provide to your RUM SDK.
applicationId:'<APPLICATION_ID>',// Required
clientToken:'<CLIENT_TOKEN>',site:'',env:'<ENV_NAME>',});
import{NgModule}from'@angular/core';import{CommonModule}from'@angular/common';import{OpenFeatureModule,EvaluationContext}from'@openfeature/angular-sdk';import{DatadogProvider}from'@datadog/openfeature-browser';constprovider=newDatadogProvider({applicationId:'<APPLICATION_ID>',clientToken:'<CLIENT_TOKEN>',site:'',env:'<ENV_NAME>',});@NgModule({imports:[CommonModule,OpenFeatureModule.forRoot({provider: provider,context:():EvaluationContext=>{// Load context from your service, localStorage, or other source
// This is a placeholder - implement based on your application's needs
returnloadContextFromLocalStorage();},}),],});exportclassAppModule{}
<div*booleanFeatureFlag="'isFeatureEnabled'; default: true; domain: 'userDomain'; else: booleanFeatureElse; initializing: booleanFeatureInitializing; reconciling: booleanFeatureReconciling"> This is shown when the feature flag is enabled.
</div><ng-template#booleanFeatureElse> This is shown when the feature flag is disabled. </ng-template><ng-template#booleanFeatureInitializing> This is shown when the feature flag is initializing. </ng-template><ng-template#booleanFeatureReconciling> This is shown when the feature flag is reconciling. </ng-template>
<div*stringFeatureFlag="'themeColor'; value: 'dark'; default: 'light'; domain: 'userDomain'; else: stringFeatureElse; initializing: stringFeatureInitializing; reconciling: stringFeatureReconciling"> This is shown when the feature flag matches the specified theme color.
</div><ng-template#stringFeatureElse> This is shown when the feature flag does not match the specified theme color. </ng-template><ng-template#stringFeatureInitializing> This is shown when the feature flag is initializing. </ng-template><ng-template#stringFeatureReconciling> This is shown when the feature flag is reconciling. </ng-template>
<div*numberFeatureFlag="'discountRate'; value: 10; default: 5; domain: 'userDomain'; else: numberFeatureElse; initializing: numberFeatureInitializing; reconciling: numberFeatureReconciling"> This is shown when the feature flag matches the specified discount rate.
</div><ng-template#numberFeatureElse> This is shown when the feature flag does not match the specified discount rate. </ng-template><ng-template#numberFeatureInitializing> This is shown when the feature flag is initializing. </ng-template><ng-template#numberFeatureReconciling> This is shown when the feature flag is reconciling. </ng-template>
<div*objectFeatureFlag="'userConfig'; value: { theme: 'dark' }; default: { theme: 'light' }; domain: 'userDomain'; else: objectFeatureElse; initializing: objectFeatureInitializing; reconciling: objectFeatureReconciling"> This is shown when the feature flag matches the specified user configuration.
</div><ng-template#objectFeatureElse> This is shown when the feature flag does not match the specified user configuration.
</ng-template><ng-template#objectFeatureInitializing> This is shown when the feature flag is initializing. </ng-template><ng-template#objectFeatureReconciling> This is shown when the feature flag is reconciling. </ng-template>
<div*booleanFeatureFlag="'isFeatureEnabled'; default: true; updateOnContextChanged: false; updateOnConfigurationChanged: false;"> This is shown when the feature flag is enabled.
</div>
<div*stringFeatureFlag="'themeColor'; value: 'dark'; default: 'light'; else: stringFeatureElse; let value; let details = evaluationDetails"> It was a match! The theme color is {{ value }} because of {{ details.reason }}
</div><ng-template#stringFeatureElselet-valuelet-details="evaluationDetails"> It was no match! The theme color is {{ value }} because of {{ details.reason }}
</ng-template>