I am building an app with Angular 7 combining with jqwidget.
I have a problem regarding jqxNotification used in Angular.
I have seen the example in below page:
angular-notification
My problem is, I hope to control the open/close of jqxnotification in an angular service.
However, if I move below items into a service:
import { Injectable, ViewChild } from ‘@angular/core’;
import { jqxNotificationComponent } from “jqwidgets-ng/jqxnotification”;
@Injectable({
providedIn: ‘root’
})
export class JqxNotifyService {
@ViewChild(‘msgNotification’) msgNotification: jqxNotificationComponent;
@ViewChild(‘timeNotification’) timeNotification: jqxNotificationComponent;
constructor() { }
openNotify() {
this.timeNotification.open();
}
}
it doesn’t work. and happens to error in browser log:
ERROR TypeError: “this.timeNotification is undefined”