Angular: Global Features API

The ConfigStateService.getGlobalFeatures API allows you to get the enabled features of the Global Features on the client side.

This document only explains the JavaScript API. See the Global Features document to understand the ABP Global Features system.

Usage


import { ConfigStateService } from '@abp/ng.core';
import { Component, OnInit } from '@angular/core';

@Component({
  /* class metadata here */
})
class DemoComponent implements OnInit {
  constructor(private config: ConfigStateService) {}
 
  ngOnInit(): void {
    // Gets all enabled global features.
    const getGlobalFeatures = this.config.getGlobalFeatures();

    //Example result is: `{ 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')

    //Example result is `true`

    this.config.getGlobalFeatureIsEnabled('My.Subscription')

     //Example result is `false`

    // or
    this.config.getGlobalFeatureIsEnabled$('Ecommerce.Subscription').subscribe((isEnabled:boolean) => {
       // use isEnabled here
    })
  }
}


JavaScript

Contributors


Last updated: May 24, 2022 Edit this page on GitHub

Was this page helpful?

Please make a selection.

To help us improve, please share your reason for the negative feedback in the field below.

Please enter a note.

Thank you for your valuable feedback!

Please note that although we cannot respond to feedback, our team will use your comments to improve the experience.

Community Talks

Real World Problems and Solutions with AI

27 Feb, 17:00
Online
Watch the Event
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book