Angular implementation
Learn how to integrate, configure, and customize Monite’s functionalities in your Angular application.
Overview
There are multiple ways to integrate the Monite drop-in with Angular. In this article, we will explore two implementation approaches:
1. Directly from the CDN
You will not be able to control the version of the Monite SDK if you consume the script directly from the CDN.
To load the Monite drop-in from the CDN, you need to create the script tag using the Renderer2
library.
Below is an example of how the Angular component could be structured. In this example, the script is loaded from https://cdn.monite.com/monite-app.js
.
2. From an NPM package
To have control over the version of the drop-in, you can also install it via NPM by following these steps:
- Include the NPM package in
package.json
:
- After installing the NPM package, add the module from
node_modules
to the assets section inangular.json
to make it accessible from the browser:
- Create a new file named
index.mjs
in the assets folder and import the drop-in:
- Now you can load the drop-in using a script tag: