From f4f2a17887691db857f3f2b04c02059207a1feb5 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Thu, 19 May 2022 12:16:11 +0300 Subject: [PATCH] Add Global feature docs for Angular --- docs/en/UI/Angular/Config-State-Service.md | 2 +- docs/en/UI/Angular/GlobalFeatures.md | 43 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docs/en/UI/Angular/GlobalFeatures.md diff --git a/docs/en/UI/Angular/Config-State-Service.md b/docs/en/UI/Angular/Config-State-Service.md index b3884f65e1..ffbf8884d6 100644 --- a/docs/en/UI/Angular/Config-State-Service.md +++ b/docs/en/UI/Angular/Config-State-Service.md @@ -13,7 +13,7 @@ import { ConfigStateService } from '@abp/ng.core'; /* class metadata here */ }) class DemoComponent { - constructor(private config: ConfigStateService) {} + constructor(private config: \) {} } ``` diff --git a/docs/en/UI/Angular/GlobalFeatures.md b/docs/en/UI/Angular/GlobalFeatures.md new file mode 100644 index 0000000000..195233f5ec --- /dev/null +++ b/docs/en/UI/Angular/GlobalFeatures.md @@ -0,0 +1,43 @@ +# Angular: Global Features API + +`ConfigStateService.getGlobalFeatures` API allows you to get the enabled features of the [Global Features](../../Global-Features.md) in the client side. + +> This document only explains the JavaScript API. See the [Global Features](../../Global-Features.md) document to understand the ABP Global Features system. + +## Usage + +````js + +import { ConfigStateService } from '@abp/ng.core'; + +@Component({ + /* class metadata here */ +}) +class DemoComponent { + constructor(private config: ConfigStateService) {} +} + +// Gets all enabled global features. +const getGlobalFeatures = this.config.getGlobalFeatures (); + +// { enabledFeatures: [ 'Shopping.Payment', 'Ecommerce.Subscription' ] } + +// or +this.config.getGlobalFeatures$().subscribe(getGlobalFeatures => { + // use getGlobalFeatures here +}) + +// Check the global feature is enabled +this.config.getGlobalFeatureIsEnabled('Ecommerce.Subscription') + +true + +> this.config.getGlobalFeatureIsEnabled('My.Subscription') + +false + +// or +this.config.getGlobalFeatureIsEnabled$('Ecommerce.Subscription').subscribe((isEnabled:boolean) => { + // use isEnabled here +}) +