Use Case:
Old static application being migrated to Angular, some of its components live on external files and will not be migrated only loaded as external files. Is it possible for the external files to influence the behavior of the Angular app?
Use Case:
Old static application being migrated to Angular, some of its components live on external files and will not be migrated only loaded as external files. Is it possible for the external files to influence the behavior of the Angular app?
By using the thread linked below I was able to achieve the goal:
// external JS file loaded into the Application
var event = new Event('customEvent');
document.dispatchEvent(event);
This is how we listen in Angular component:
@HostListener('document:customEvent', ['$event'])
onCustomEvent(e) {
console.log(e);
}