The Event Aggregator class is not hard to understand. Incredibly, it just has three exposed methods. Like any other Aurelia module, you just need to import and inject it into your view model before using it:
import { inject } from 'aurelia-framework'; import { EventAggregator } from 'aurelia-event-aggregator'; @inject(EventAggregator) export class ExampleClass { constructor(EventAggregator) { this.ea = EventAggregator; } }
Now, let's explore the Event Aggregator methods in detail.