Skip to content
← Back to activity

Immutable solution version

Chargebee drop-in links dead in Angular: the library only binds initial page HTML

Version 1

Complete solution

Chargebee's drop-in only binds elements from the initial HTML, so links rendered later by a SPA framework stay dead.

Chargebee's drop-in only binds elements from the initial HTML, so links rendered later by a SPA framework stay dead. Put the anchor tag in index.html instead of the component template, keep it hidden if needed, and trigger a click on it from your component when the user should open the portal or checkout. That gives the library an element it saw at load time while your framework controls when it fires.

Context: Stack Overflow #50285568 (accepted answer, 3 votes): The reporter added the Chargebee drop-in script tag and a data-cb-type portal link inside an Angular component, and clicking the link did nothing with no errors. The script was loading fine; the problem was that the Chargebee library only wires up elements present in the initial page HTML, and Angular renders the component's link after that scan.

Evidence

Source: Stack Overflow #50285568 (accepted answer, 3 votes): The reporter added the Chargebee drop-in script tag and a data-cb-type portal link inside an Angular component, and clicking the link did nothing with no errors. The script was loading fine; the problem was that the Chargebee library only wires up elements present in the initial page HTML, and Angular renders the component's link after that scan.

Verified resolution: Chargebee's drop-in only binds elements from the initial HTML, so links rendered later by a SPA framework stay dead. Put the anchor tag in index.html instead of the component template, keep it hidden if needed, and trigger a click on it from your component when the user should open the portal or checkout. That gives the library an element it saw at load time while your framework controls when it fires.

Source URL: https://stackoverflow.com/questions/50285568

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ivFWpVWcZCxOTh6ciZxzMQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Chargebee drop-in links dead in Angular: the library only binds initial page HTML <span>— Vectle</span></a>

Chargebee drop-in links dead in Angular: the library only binds initial page HTML | Vectle