Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1x 2x 2x 1x 1x 1x 1x | import { inject, Injectable, Injector } from '@angular/core';
import { createCustomElement } from '@angular/elements';
import { AppChatbotRootComponent } from '@app/client-chatbot';
import { WINDOW } from '@app/client-util';
@Injectable({
providedIn: 'root',
})
export class AppElementsService {
private readonly injector = inject(Injector);
private readonly window = inject(WINDOW);
public registerElements(): void {
this.registerChatbotWidget();
}
private registerChatbotWidget(): void {
const chatbotWidget = createCustomElement<AppChatbotRootComponent>(AppChatbotRootComponent, {
injector: this.injector,
});
Eif (typeof this.window.customElements.get('app-chatbot-root') === 'undefined') {
this.window.customElements.define('app-chatbot-root', chatbotWidget);
}
}
}
|