Reputation: 83
I have an angular 1.5 app on a page surrounded by a jQuery application. I want to notify the surrounding page or jQuery application that an event has occurred in the AngularJS app i.e validation issue. How can i do this?
Upvotes: 0
Views: 34
Reputation: 1212
// Add an event listener
document.addEventListener("name-of-event", function(e) {
console.log(e.detail); // Prints "Example of an event"
});
// Create the event
var event = new CustomEvent("name-of-event", { "detail": "Example of an event" });
// Dispatch/Trigger/Fire the event
document.dispatchEvent(event);
Upvotes: 1