I would like to add parameter in gql query :
onSubmit() {
console.log(this.contact);
let SendEmailQuery = gql`
{
sendemail(contactorFirstname:"",
contactorLastname:"",
contactorEmail:"",
contacteeFirstname:"firstname",
contacteeLastname:"",
contacteeEmail:"")
}
`;
this.apollo.watchQuery({ query: SendEmailQuery
}).valueChanges.subscribe(({data, loading}) => {
this.data = data;
this.loading = loading;
});
rather to add "firstname" hardcoded, I would like to pass a parameter ? anyone have an idea how to do it ?
thank you for your feedback,
best regards,
Nicolas Maujean
You can use an interpolated expression to pass a parameter in your query:
contacteeFirstname: "${firstname}"