Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.3 KiB

Creating a Settings Tab

There are several settings tabs from different modules. You can add custom settings tabs to your project in 3 steps.

  1. Create a Component
import { Select } from '@ngxs/store';
import { Component } from '@angular/core';

@Component({
  selector: 'app-your-custom-settings',
  template: `
    your-custom-settings works! mySetting: {%{{{ mySetting$ | async }}}%}
  `,
})
export class YourCustomSettingsComponent {
  @Select(ConfigState.getSetting('MyProjectName.MySetting1')) // Gets a setting. MyProjectName.MySetting1 is a setting key.
  mySetting$: Observable<string>; // The selected setting is set to the mySetting variable as Observable.
}
  1. Add the YourCustomSettingsComponent to declarations and the entryComponents arrays in the AppModule.

  2. Open the app.component.ts and add the below content to the ngOnInit

import { addSettingTab } from '@abp/ng.theme.shared';
// ...

ngOnInit() {
  addSettingTab({
    component: YourCustomSettingsComponent,
    name: 'Type here the setting tab title (you can type a localization key, e.g: AbpAccount::Login',
    order: 4,
    requiredPolicy: 'type here a policy key'
  });
}

Open the setting-management page to see the changes:

Custom Settings Tab