question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onTap not working with preventDuplicates

See original GitHub issue

First I want to thank you for your hard work.

I’ve used toastr with onTap from ActiveToast and every time I click on it redirects me to a different page.

this.toastrService.success('message').onTap.subscribe(() => {
  this.router.navigateByUrl('/');
});

It’s work great but when I’ve tried to block duplicate messages (preventDuplicates) I get: ERROR TypeError: Cannot read property 'onTap' of null.

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
scttcpercommented, Oct 16, 2017

just check if its null. I think turning on typescript’s strict mode would’ve caught this as well.

const toast = this.toastrService.success('message')
if (toast) {
  toast.onTap.subscribe(() => {
    this.router.navigateByUrl('/');
  });
}
1reaction
trevor-hackettcommented, Oct 16, 2017

Yeah, it looks like if ToastrService detects a duplicate message it will return null https://github.com/scttcper/ngx-toastr/blob/5829621f196c23a71a14768a935629e16bc57902/src/lib/toastr/toastr-service.ts#L179-L181

Read more comments on GitHub >

github_iconTop Results From Across the Web

onTap function not working for Align widgets in Flutter
I need to call a function on tap of Align widget but only half the area of GestureDetector is working and on other...
Read more >
ngx-toastr - npm
Start using ngx-toastr in your project by running `npm i ngx-toastr`. ... Reset toast timeout on duplicate (preventDuplicates must be true).
Read more >
Cut your Cloud Storage TCO by 80% with NetApp ... - CloudPort
More often than not, you end up in a situation where your costs go ... Using native technology called WAFL, ONTAP can prevent...
Read more >
Attribute Quick Add - Documentation
Video Guide. Features. Quickly add option values to drop-down and multi-select attributes; Automatically de-duplicates options; Bulk change values ...
Read more >
AngularJS 1.4.x and Angular Toastr custom properties not ...
preventDuplicates && map.message === previousToastMessage; var isDuplicateOpen ... onTap: null, positionClass: 'toast-top-right', preventDuplicates: false, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found