jQWidgets Forums

jQuery UI Widgets Forums Angular control the open/close of a JqxNotification in a service

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • wureka
    Participant

    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”


    Hristo
    Participant

    Hello wureka,

    To Inject some component I would like to suggest you look at this tutorial.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.