Issue event after close ngx-toastr Angular

Asked

Viewed 25 times

0

I am using the following code to generate the Poup-up toastr

showSuccess() {
    this.toastr.success('You are awesome!', 'Success!', {
        onHidden: () => {
            console.log('hidden')
        },
        onCloseClick: (toastId: number) => {
            console.log('close')
        }
    });
}

but nothing happens when I close the toastr, there is another way?

1 answer

0

Try to save the function call into a variable and sign up for the Observable:

const toast = this.toastr.success('You are awesome!', 'Success!', {
        onHidden: () => {
            console.log('hidden')
        },
        onCloseClick: (toastId: number) => {
            console.log('close')
        }
    });

toast.onAction.subscribe((action) => console.log(action));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.