Open Closed

Angular: Custom Setting Page #444


User avatar
0
bozkan created

Hi, I am trying to apply the instructions for creating the custom setting page and for the server side everything seems okey while information about the client side is not enough for me. I am using Angular v9 and created my own component with forming the html as well however, there is no such thing as abp.setting.get() to get the custom setting value from the server side. It has warning like "cannot find name 'abp'". I guess it is applicable for the AngularJS but not Angular 2+.

So , how can .I get the custom setting from the server side and show/update on my Angular page?

used documentation : https://docs.abp.io/en/abp/latest/UI/Angular/Custom-Setting-Page another reference (for the old version) : https://aspnetboilerplate.com/Pages/Documents/Setting-Management

Thanks

  • ABP Framework version: v3.0.5
  • UI type: Angular

So far I have :

no code written in .ts file.


9 Answer(s)
  • User Avatar
    0
    Mehmet created

    Hi @bozkan

    Can you share the setting property of application-configuration response with us?

  • User Avatar
    0
    bozkan created

    "setting": { "values": { "Abp.Localization.DefaultLanguage": "en", "Volo.Abp.LeptonTheme.Layout.Boxed": "False", "Volo.Abp.LeptonTheme.Layout.MenuPlacement": "Top", "Volo.Abp.LeptonTheme.Layout.MenuStatus": "OpenOnHover", "Volo.Abp.LeptonTheme.Style": "Style5", "Abp.Timing.TimeZone": "UTC", "Abp.Identity.Password.RequiredLength": "6", "Abp.Identity.Password.RequiredUniqueChars": "1", "Abp.Identity.Password.RequireNonAlphanumeric": "True", "Abp.Identity.Password.RequireLowercase": "True", "Abp.Identity.Password.RequireUppercase": "True", "Abp.Identity.Password.RequireDigit": "True", "Abp.Identity.Lockout.AllowedForNewUsers": "True", "Abp.Identity.Lockout.LockoutDuration": "300", "Abp.Identity.Lockout.MaxFailedAccessAttempts": "5", "Abp.Identity.SignIn.RequireConfirmedEmail": "False", "Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "True", "Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "False", "Abp.Identity.User.IsUserNameUpdateEnabled": "True", "Abp.Identity.User.IsEmailUpdateEnabled": "True", "Abp.Identity.OrganizationUnit.MaxUserMembershipCount": "2147483647", "Abp.Account.IsSelfRegistrationEnabled": "False", "Abp.Account.EnableLocalLogin": "True", "Abp.Account.TwoFactorLogin.IsRememberBrowserEnabled": "True", "Abp.Account.EnableLdapLogin": "false" }

  • User Avatar
    0
    Mehmet created

    You can get a setting value as shown below:

    import { ConfigStateService } from '@abp/ng.core';
    
    @Component(/* component metadata */)
    export class YourComponent {
      constructor(private config: ConfigStateService) {
        const maxUserMembershipCount = this.config.getSetting('Abp.Identity.OrganizationUnit.MaxUserMembershipCount')
        console.log(maxUserMembershipCount) // 2147483647
      }
    }
    
  • User Avatar
    0
    bozkan created

    However I want to use my own setting instead of using the default ones that called as "IndexingSettings" that you can see from the screenshot actually.I already added the setting tab using following the documentation I specified and the only thing I have trouble with getting the related setting values from the server side. Can I use ConfigStateService for it as well and if it so how can I add my customized setting to there?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @bozkan

    Please refer to Settings document. This is apply for abp vnext. https://docs.abp.io/en/abp/latest/Settings

  • User Avatar
    0
    bozkan created

    Hi, I already checked the document and its Reading Setting Values on the Client Side parts is not clear for me. When I try to use abp.setting.get() get an error as "cannot find name abp" so cannot get the value. We already completed the server side for the setting definition so only thing is getting and showing the value on the client side.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    When I try to use abp.setting.get() get an error as "cannot find name abp"

    abp.setting.get only applies to mvc, for angular you should refer to: https://support.abp.io/QA/Questions/444#answer-b53630fd-c319-0a02-f4d8-39f7f04a4e29

  • User Avatar
    0
    bozkan created

    Okay , so for our customized setting do I need to create new endpoint to reach it on the backend? Like ; "/api/account-admin/settings" or "​/api​/lepton-theme-management​/settings"

    Thank you

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    If the IsVisibleToClients property of setting is true, you can refer to the above code to read it in angular. https://support.abp.io/QA/Questions/444#answer-b53630fd-c319-0a02-f4d8-39f7f04a4e29

    Otherwise you need to create your own application service method to get and update settings.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15