Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created features document for the Angular UI #5949

Merged
merged 3 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions docs/en/UI/Angular/Config-State.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ const searchUrl = this.config.getApiUrl("search");

This method returns the `url` of a specific API based on the key given as its only parameter. If there is no key, `'default'` is used.

### How to Get a Specific Feature From the Store

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

```js
// this.config is instance of ConfigStateService

const isChatEnabled = this.config.getFeature("Chat.Enable");
// 'en'
```

### How to Get a Specific Permission From the Store

You can use the `getGrantedPolicy` method of `ConfigStateService` to get a specific permission from the configuration state. For that, you should pass a policy key as parameter to the method.
Expand Down Expand Up @@ -200,6 +189,7 @@ Please refer to `Config.Environment` type for all the properties you can pass to
## See Also

- [Settings](./Settings.md)
- [Features](./Features.md)

## What's Next?

Expand Down
38 changes: 36 additions & 2 deletions docs/en/UI/Angular/Features.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# Angular UI: Features
# Features

> This document explains how to get feature values in an Angular application. See the [Features document](../../Features.md) to learn the feature system.
You can get the value of a feature on the client-side using the [config state service](./Config-State.md) 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](../../Features.md) 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**.

```js
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:

```js
// 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**.

## What's Next?

- [Permission Management](./Permission-Management.md)
2 changes: 1 addition & 1 deletion docs/en/UI/Angular/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Beware though, **settings search is case-sensitive**.

## What's Next?

- [Permission Management](./Permission-Management.md)
- [Features](./Features.md)
4 changes: 4 additions & 0 deletions docs/en/docs-nav.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@
"text": "Settings",
"path": "UI/Angular/Settings.md"
},
{
"text": "Features",
"path": "UI/Angular/Features.md"
},
{
"text": "Permission Management",
"path": "UI/Angular/Permission-Management.md"
Expand Down