Home > Blockchain >  how to pass variable in http in angular 9
how to pass variable in http in angular 9

Time:11-25

''' how will i add fromDateTime and toDateTime as parameters to be passed in this link.'''

 export function MSALInterceptorConfigFactory(): MsalInterceptorConfiguration {
      const protectedResourceMap = new Map<string, Array<string>>();
      protectedResourceMap.set('https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=2019-11-01,toDateTime=2019-12-01', ['CallRecords.Read.All','CallRecord-PstnCalls.Read.All','CallRecords.Read.All']);
    
      return {
        interactionType: InteractionType.Redirect,
        protectedResourceMap
      };
    }

CodePudding user response:

You can take advantage of string interpolation:

let queryUrl = `https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=${fromDatetimeVariable},toDateTime=${toDatetimeVariable}`

Note that the string is surrounded in backticks (`) not in quotes (')

  • Related