This section will guide you through integrating the Mingleego chatbot into an Angular project. Angular is a popular TypeScript-based web application framework developed by Google. This guide works for Angular 2+ (including Angular 15, 16, 17, and later versions).
Note for Complete Beginners: If you don't have an Angular project yet, you'll need to create one first. This guide assumes you already have an Angular project set up. To create a new Angular project, follow the official Angular Getting Started guide which provides step-by-step instructions for installing the Angular CLI, creating a new project, and running your development server.
⚠️ Angular-specific requirement: Angular does not recognize unknown HTML elements by default. Before adding <mingleego-webchat> to any Angular template, you need to add a special schema (CUSTOM_ELEMENTS_SCHEMA) to tell Angular it's a valid custom element. This guide shows you exactly where to add it — the process depends on your Angular version and project type. Read the section Before You Start below before jumping to the integration steps.
Angular projects come in two types. It is important to know which type your project uses before following the steps below.
Run this command in your terminal (inside your project folder):
1
You'll see output like:
Angular CLI: 17.3.0
Angular: 17.3.0
Alternatively, open package.json in your project root and look for @angular/core:
1 2 3
The first number (17 in 17.3.0) is your major version.
Angular 16 and earlier always used NgModule architecture. Angular 17 introduced Standalone as the new default, but older-style projects may still use NgModule.
| App Type | How to identify |
|---|---|
| NgModule | A file called app.module.ts exists at src/app/app.module.ts |
| Standalone | No app.module.ts file — your app.component.ts has standalone: true |
To check, simply open your project in a file explorer or code editor and look inside the src/app/ folder:
src/app/
├── app.module.ts ← If this file exists → NgModule app
├── app.component.ts
├── app.component.html
└── ...
If there is no app.module.ts, your project is a Standalone app (Angular 17+ default).
What you're doing: You need to get the chatbot script file and put it in the right location in your Angular project.
Download the Script File:
mingleego-chatbot-script.js or similar)
Find Your Angular Project's Assets Directory:
src at the root level of your projectsrc folder, look for a folder called assetsassets folder, create one — it's a standard Angular directory for static filesCopy the Script File:
Copy the downloaded script file and paste it directly into the src/assets folder
Your file structure should now look like this:
your-angular-project/
├── src/
│ ├── assets/
│ │ ├── mingleego-chatbot-script.js ← Your chatbot script goes here
│ │ └── (other asset files)
│ ├── app/
│ └── index.html
├── node_modules/
├── angular.json
└── package.json
Important: Make sure the file is directly inside the src/assets folder. Remember the exact filename — you'll need it in the next step.
What you're doing: You need to tell your Angular app to load the chatbot script when the app loads. Angular provides two ways to do this.
Method 1: Add Script to index.html (Recommended for Beginners)
Find the index.html file in src/index.html and open it with a text editor.
Add the script tag inside the <head> section:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Note: Replace mingleego-chatbot-script.js with the actual name of your file. The defer attribute loads the script after the HTML is parsed, which is good for performance.
Method 2: Add Script to angular.json (Alternative)
Open angular.json in the root of your project.
Find "projects" → your project name → "architect" → "build" → "options" → "scripts" array and add your file:
1 2 3 4 5 6 7 8 9 10 11 12 13
After saving, restart the dev server (ng serve) for the changes to take effect.
Note: Use one method or the other — not both.
What you're doing: Now place the chatbot element on your page. Choose the option that fits your needs.
Which Option Should You Choose?
| Option | Best For |
|---|---|
Option A — Via app.component.html | Simple apps, or you want the chatbot on every page |
Option B — Via index.html (outside <app-root>) | If the chatbot button is visible but not clickable (z-index issue) |
| Option C — Via a specific component | You want the chatbot only on certain pages |
| Option D — TypeScript support | You want TypeScript to recognize the element without errors |
Option A — All Pages (via app.component.html)
This places the chatbot on every page of your app. It requires adding CUSTOM_ELEMENTS_SCHEMA first.
Sub-step 1: Add CUSTOM_ELEMENTS_SCHEMA
You need to do this once to allow Angular to use the <mingleego-webchat> element in templates.
Not sure which type your project is? See Before You Start above.
If your project uses NgModule (has app.module.ts):
Open src/app/app.module.ts and add CUSTOM_ELEMENTS_SCHEMA:
1 2 3 4 5 6 7 8 9 10 11 12 13
If your project uses Standalone (no app.module.ts):
Open src/app/app.component.ts and add CUSTOM_ELEMENTS_SCHEMA:
1 2 3 4 5 6 7 8 9 10 11 12 13
Sub-step 2: Add the element to app.component.html
Open src/app/app.component.html and add <mingleego-webchat></mingleego-webchat> at the end:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Your file structure:
src/
└── app/
├── app.module.ts ← Edit this (NgModule only)
├── app.component.ts ← Edit this (Standalone only)
├── app.component.html ← Add <mingleego-webchat> here
└── ...
Option B — Place in index.html Outside <app-root> (Safest)
This approach places the chatbot element completely outside the Angular app. It avoids z-index and stacking context issues, and does not require CUSTOM_ELEMENTS_SCHEMA since the element is not inside an Angular template.
Open src/index.html and add <mingleego-webchat></mingleego-webchat> after <app-root></app-root>:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Why this works: When <mingleego-webchat> is placed outside <app-root>, it is not inside Angular's component tree. This means your app's CSS and z-index rules cannot interfere with the chatbot button, so it is always clickable. This is the recommended option if the chatbot button is visible on screen but cannot be clicked.
Your file structure:
src/
├── index.html ← Add <mingleego-webchat> here (after <app-root>)
└── app/
└── ... ← No changes needed here
Option C — Specific Pages Only (via a Specific Component)
This places the chatbot only on certain pages. It requires adding CUSTOM_ELEMENTS_SCHEMA to the component (or its module) that you want to show the chatbot on.
Example: Show the chatbot only on the Contact page.
Sub-step 1: Add CUSTOM_ELEMENTS_SCHEMA to the component's module or decorator
Not sure which type your project is? See Before You Start above.
If your project uses NgModule (has app.module.ts):
Find the module that declares your target component. If the Contact component is declared in contact.module.ts:
1 2 3 4 5 6 7 8 9 10 11 12
If there is no separate module for this component, you can add CUSTOM_ELEMENTS_SCHEMA to the root app.module.ts as shown in Option A — this is the simplest approach.
If your project uses Standalone (no app.module.ts):
Open the component TypeScript file and add CUSTOM_ELEMENTS_SCHEMA:
1 2 3 4 5 6 7 8 9 10 11 12 13
Sub-step 2: Add the element to the component's HTML template
Open the component's HTML file and add <mingleego-webchat></mingleego-webchat>:
1 2 3 4 5 6 7 8 9
Your file structure:
src/
└── app/
├── app.module.ts ← No changes needed (NgModule — if editing per-module instead)
└── contact/
├── contact.module.ts ← Edit this (NgModule — add CUSTOM_ELEMENTS_SCHEMA)
├── contact.component.ts ← Edit this (Standalone — add CUSTOM_ELEMENTS_SCHEMA)
├── contact.component.html ← Add <mingleego-webchat> here
└── contact.component.css
Tip: You can add the chatbot to multiple component HTML files to show it on multiple specific pages. Just make sure each component's module (NgModule) or decorator (Standalone) has CUSTOM_ELEMENTS_SCHEMA added.
Option D — TypeScript Type Declarations
Angular already uses TypeScript, but you may see TypeScript errors when referencing the chatbot element in component code (for example, with document.querySelector('mingleego-webchat')). This option silences those errors by declaring the element as a known type.
Note: This option is only needed if you're accessing the element from TypeScript code. If you're only placing <mingleego-webchat> in HTML templates, you can skip this option.
Create a type declaration file:
Create a new file called custom-elements.d.ts inside a src/types/ folder (create the types folder if it doesn't exist):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Make sure TypeScript includes this file. Open tsconfig.app.json (or tsconfig.json) and check that the include array covers src/**/*.d.ts:
1 2 3 4 5 6
Your file structure:
src/
├── types/
│ └── custom-elements.d.ts ← Create this file
├── app/
│ └── ...
└── index.html
What you're doing: Start your Angular app and verify the chatbot works correctly.
Start Your Development Server:
1 2
Wait for the compilation to complete — you should see "Compiled successfully" or "Application bundle generation complete".
Open Your App in the Browser:
http://localhost:4200Verify the Chatbot Works:
Common Issues and Solutions:
Problem: Angular build error — 'mingleego-webchat' is not a known element
CUSTOM_ELEMENTS_SCHEMA to the module or component that uses <mingleego-webchat>. See Step 3 (Option A or C) for detailed instructionsProblem: The chatbot button is visible but cannot be clicked
<mingleego-webchat> in index.html outside <app-root>. This removes it from Angular's stacking context entirely and makes it always accessibleProblem: The chatbot doesn't appear at all
index.html (or angular.json) exactly matches the actual filename in src/assets/ — it's case-sensitiveangular.json method, restart the dev server after making changesProblem: The chatbot appears but doesn't work
Problem: Angular angular.json build error after adding the script
index.html method instead, which is simplerBuild for Production (Optional):
1
The chatbot script in src/assets/ is automatically included in the build output.
To integrate the Mingleego chatbot into your Angular project:
src/assets/<script> tag in src/index.html (or add to scripts in angular.json)CUSTOM_ELEMENTS_SCHEMA to the module or component that uses the element<mingleego-webchat></mingleego-webchat> using the option that fits your needs:| Option | When to use |
|---|---|
Option A — app.component.html | Chatbot on every page, simple setup |
Option B — index.html outside <app-root> | Chatbot on every page, avoids z-index issues |
| Option C — specific component HTML | Chatbot on specific pages only |
| Option D — TypeScript declarations | Silence TypeScript errors in .ts files |
Once these steps are complete, your chatbot should be live and ready to interact with your website visitors!