I am using Angular 2 and I was wondering if it's possible to add a hyperlink to a toast message. I poked around online and saw some stuff that might work but I was wondering if there is a clear cut and easy way to implement this. Thanks!
Edit: Or if there is a way to navigate to a different url by clicking on a toast message
There are two different approaches for embedding any sort of HTML content within a toast.
By importing BodyOutputType from
angular2-toaster
, you can specify either TrustedHtml or Component. The first allows you to pass the html directly into thebody
argument of the toast:The second allows you to pass the name of a component. The component is dynamically loaded and rendered as the toast body.
You can see both approaches in this plunker.