I use the EventAggregator in several places in my app and everything works fine. However I’m having trouble injecting it into one of my classes. When the class constructor is called, the EventAggregator argument is undefined.
import {EventAggregator} from 'aurelia-event-aggregator';
import {inject} from 'aurelia-framework';
@inject(EventAggregator)
export class Test {
constructor(eventAggregator) {
debugger;
this.eventAggregator = eventAggregator;
}
}
When stopping at the debugger;
line, the constructor’s eventAggregator argument is undefined.
This looks just like what I have done to use EventAggregator in many other classes, so what could be the issue?