Implementation Guide
Angular Integration
Integrate using modern lifecycle hooks. The client automatically handles route changes for you.
Initialization
Call init when your app mounts and destroy when it unmounts to prevent memory leaks.
import { Component, OnInit, OnDestroy } from '@angular/core';
@Component({...})
export class AppComponent implements OnInit, OnDestroy {
private script?: HTMLScriptElement;
ngOnInit() {
this.script = document.createElement('script');
this.script.src = 'https://cdn.tagtics.online/client.js';
this.script.async = true;
this.script.onload = () => {
(window as any).Tagtics?.init({ apiKey: 'YOUR_API_KEY' });
};
document.body.appendChild(this.script);
}
ngOnDestroy() {
(window as any).Tagtics?.destroy();
this.script?.remove();
}
}