Features

You can get the value of a feature on the client-side using the config state service if it is allowed by the feature definition on the server-side.

This document explains how to get feature values in an Angular application. See the Features document to learn the feature system.

Before Use

To use the ConfigStateService, you must inject it in your class as a dependency. You do not have to provide the service explicitly, because it is already provided in root.

import { ConfigStateService } from '@abp/ng.core';

@Component({
  /* class metadata here */
})
class DemoComponent {
  constructor(private config: ConfigStateService) {}
}

How to Get a Specific Feature

You can use the getFeature method of ConfigStateService to get a specific feature from the configuration state. Here is an example:

// this.config is instance of ConfigStateService

const defaultLang = this.config.getFeature("Identity.TwoFactor");
// 'Optional'

You can then check the value of the feature to perform your logic. Please note that feature keys are case-sensitive.

Contributors


Last updated: November 06, 2020 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.

In this document
Community Talks

Building Modular Monolith Applications Using .NET and ABP Framework

17 Oct, 17:00
Online
Watch the Event
Mastering ABP Framework Book
Mastering ABP Framework

This book will help you gain a complete understanding of the framework and modern web application development techniques.

Learn More