Reputation: 147
I am trying to embed the Calendly widget into an Angular app and am not quite sure how to accomplish this. Since I will be calling this widget with variable data, I would like to invoke the widget with a user activated function. Based on the documentation and this StackOverflow I have added the following method in my component:
getEventCalender() {
Calendly.initInlineWidget({
url: myVariable.url,
parentElement: document.querySelector('.calendly-inline-widget'),
});
}
and call it with the following (in my .html)
<div>
<button (click)='getEventCalender()'>view cal</button>
</div>
<div class="calendly-inline-widget"></div>
I can see that I need the Calendly.initInlineWidget
method supplied by the .js api, however I'm not quite sure how to access it. I have tried downloading the file and importing it into my component, however it didn't work (maybe I did this incorrectly). I suspect this has something to do with the .js file not exporting the method, but not sure where to go from here.
Can anyone provide some direction?
Upvotes: 1
Views: 1630
Reputation: 38
We had a similar issue in our vanilla JS app and found the solution described in their Advanced embed options documentation. We did this by:
data-auto-load="false"
to the calendly-inline-widget
div
.parentElement
to the initInlineWidget
function params.Extra info: @remy-bartolotta we had the exact split
error you described and the above info fixed it.
Upvotes: 1