Open Closed

Execute method after authenticated in angular client #6633


User avatar
0
pablo@ccalp.net created
  • ABP Framework version: v7.4.x
  • UI Type: Angular
  • Database System: EF Core (SQL Server)

I have created my own custom configuration service and added it to the app.module as a provider:

{
  provide: APP_INITIALIZER,
  useFactory: configurationFactory,
  deps: [ConfigurationService, ConfigStateService],
  multi: true,
},

There are configuration properties that I need before authentication and after authentication, how can I call my configuration service after the user has authenticated to refresh the configuration properties?

I see this being done already by the abp framework, how can I achieve the same?

Thanks.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello,

    I am not exactly sure but I think this might help you.

    try to call your method inside below code in app.component.ts

    export class AppComponent {
      constructor(private authService:AuthService)   { }
       
      ngOnInit(): void {
      
       if(this.authService.isAuthenticated){
        console.log('logged in');
        //you can call your method here for refreshing the configuration properties
       }
    }
    }
    

    thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    pablo@ccalp.net created

    Yeah, that's what I have, not sure if there was another way. Do you know how it is handled by the framework, is there any source code I can reference?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    Maybe you can consider this: https://docs.abp.io/en/abp/latest/UI/Angular/Config-State-Service#set-state

    import {AbpApplicationConfigurationService, ConfigStateService} from '@abp/ng.core';
    
    constructor(private abpApplicationConfigurationService: AbpApplicationConfigurationService, private config: ConfigStateService) {
      this.abpApplicationConfigurationService.get().subscribe(config => {
        //you can call your method here for refreshing the configuration properties
      })
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 23, 2026, 09:57
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.