0

I need to use Angular Material toaster in every page of my project and the message may contain html tags. But the html message is not working with Angular Material toaster.

$mdToast.show(
    $mdToast.simple()
       .textContent('Field is required <br> Some Other Content')
       .position(pos)
       .hideDelay(3000)
);

Any idea ?

Alex M
  • 2,756
  • 7
  • 29
  • 35
Haseena P A
  • 16,858
  • 4
  • 18
  • 35

2 Answers2

1

For example, you can do it like that.

var displayToast = function(type, msg) {
    $mdToast.show({
        template: '`<br/>`' + msg + '`<br/>`',
        hideDelay: 6000,
        position: 'bottom right'
    });
};
Umut Catal
  • 421
  • 4
  • 11
0

you can do so

$mdToast.show({
          hideDelay   : 3000,
          position    : 'top right',
          templateUrl : 'your_template.html'
        });

and in your template

<div>Field is required <br> Some Other Content</div>
Dan M. CISSOKHO
  • 1,070
  • 1
  • 12
  • 27