Topic: Cannot Alert (ToastrService) in Angular 4
passakorn “Bee” CHOOSUK pro asked 7 years ago
I\\\'m trying to use Alerts, but not success. I use it like this
import { Component, OnInit } from \\\'@angular/core\\\';
import { NotiService } from \\\'../service/noti/noti.service\\\';
import { ToastrService } from \\\'../angular-bootstrap-md/pro/alerts\\\'
@Component({
selector:\\\'app-noti-emg\\\',
templateUrl:\\\'./noti-emg.component.html\\\',
styleUrls: [\\\'./noti-emg.component.scss\\\']
})
export class NotiEmgComponent implements OnInit {
notiList= [];
constructor(private notiService:NotiService, private toastrService:ToastrService) { }
showSuccess() {
this.toastrService.success(\\\'Info message\\\');
}
....
}
when I ng-serve there\\\'s an error like this
ERROR Error: Uncaught (in promise): Error: No provider for InjectionToken ToastConfig!Error: No provider for InjectionToken ToastConfig!at injectionError (core.es5.js:1169)at noProviderError (core.es5.js:1207)at ReflectiveInjector_._throwOrNull (core.es5.js:2649)at ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)at ReflectiveInjector_._getByKey (core.es5.js:2620)at ReflectiveInjector_.get (core.es5.js:2489)at resolveNgModuleDep (core.es5.js:9475)at _createClass (core.es5.js:9526)at _createProviderInstance$1 (core.es5.js:9486)at resolveNgModuleDep (core.es5.js:9471)at injectionError (core.es5.js:1169)at noProviderError (core.es5.js:1207)at ReflectiveInjector_._throwOrNull (core.es5.js:2649)at ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)at ReflectiveInjector_._getByKey (core.es5.js:2620)at ReflectiveInjector_.get (core.es5.js:2489)at resolveNgModuleDep (core.es5.js:9475)at _createClass (core.es5.js:9526)at _createProviderInstance$1 (core.es5.js:9486)at resolveNgModuleDep (core.es5.js:9471)at resolvePromise (zone.js:783)at resolvePromise (zone.js:754)at zone.js:831at ZoneDelegate.invokeTask (zone.js:424)at Object.onInvokeTask (core.es5.js:3881)at ZoneDelegate.invokeTask (zone.js:423)at Zone.runTask (zone.js:191)at drainMicroTaskQueue (zone.js:595)at ZoneTask.invokeTask [as invoke] (zone.js:502)at invokeTask (zone.js:1370)
PS. I add ToastrService to app.module.ts already, thanks
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Closed
Specification of the issue
- ForumUser: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Tags
xzesstence pro commented 6 years ago
1 year and no answer also no information about toastr... argh mdb why is this paid module such pain???