Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
How to use methods of classes in Angular export function

I'd like to use a method in a export function defined in a class file.

export function MSALInstanceFactory(): IPublicClientApplication {
    return new PublicClientApplication({
        auth: AzureService.getConfiguration(), <-------- Compilation Error
        cache: {
            cacheLocation: BrowserCacheLocation.LocalStorage,
            storeAuthStateInCookie: isIE, // set to true for IE 11. Remove this line to use Angular Universal
        }
    });
}

export class AzureModule { }

This is the Service Class

@Injectable()
export class AzureService {

    constructor(private identityManagerApiRestService: IdentityManagerApiRestService) { }

    getConfiguration(): BrowserAuthOptions {
        let options: BrowserAuthOptions;
        this.identityManagerApiRestService.getAuthenticationConfiguration().subscribe(response =>{
            options.clientId = response.authenticationConfiguration.clientId;
            options.authority = response.authenticationConfiguration.authority;
            options.redirectUri = response.authenticationConfiguration.redirectUri;
        });
        return options;
    }
}

How can I use AzureService.getConfiguration() method in the exported function method in the Module. I want this because the values are dynamic and they are obtained in a rest call.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

try

const Service = new AzureService(IdentityManagerApiRestService)
let a = Service.getConfiguration()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!