Unable to display Toast message in Angular 5

一个人想着一个人 提交于 2019-11-29 17:31:58

Make sure you imported ToastrModule in app.module.ts

import {ToastrModule} from 'ngx-toastr';

in your component, you need to import the provider

import { ToastrService } from 'ngx-toastr';

injector in the constructor as DI

constructor(public toastr: ToastrService) {}

And you can invoke it as

this.toastr.success(message, 'Success!');

EDIT

You need to move to angular6 inorder to make it work. Check the related issue here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!