An issue occurred while compiling the 'ToastContainer' template. Decorators do not support function calls, and the call to 'trigger' caused an error

When I run ng serve and ng build, there are no errors. However, when I run ng build --prod, I encounter this error. Can anyone help me fix it?

ERROR in Error during template compile of 'ToastContainer' Function calls are not supported in decorators but 'trigger' was called

Answer №1

When working with Angular 8 and using ng2-toastr, consider switching to ngx-toastr

Answer №2

Include the following code in the Index page

<link href="node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet" />
<script src="node_modules/ng2-toastr/bundles/ng2-toastr.min.js"></script>

This solution worked for me on Angular 9

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

No interface 'JSX.IntrinsicElements' could be found, causing the JSX element to be implicitly of type 'any'

<Header> <title>Real Estate API Application</title> <meta name="description" content="Generated by create next app" /> <meta name="viewport" content="width=device-width, ...

Hello, I am looking for a way to maintain a user's active session when transitioning between different Angular applications without constantly prompting them to login. Can you help me

After logging in with my credentials, the session starts. However, if the user does not have an administrator role, I need to redirect them to another application. The challenge is maintaining the active session without requiring the user to log in again ...

The factory class is responsible for generating objects without specifying their type

I manage a factory that specializes in facilitating dependency injection. Here's an example of what it looks like: import SomeImportantObject from "./SomeImportantObject" import DataInterface from "./DataInterface" class NoodleFactory { this.depen ...

Subscribing to Observables in Angular Services: How Using them with ngOnChanges Can Trigger Excessive Callbacks

Consider the following scenario (simplified): Main Component List Component List Service Here is how they are connected: Main Component <my-list [month]="month"></my-list> List Component HTML <li *ngFor="let item in list | async>&l ...

Tips for simulating the getCustomRepository function in typeORM

I am facing a challenge in unit-testing a class that has a getCustomRepository method in its constructor. I'm struggling to find an easy way to mock it. Below is the code for my class: import {getCustomRepository} from 'typeorm'; export cl ...

Encountering an issue connecting to the backend server for the

I am attempting to make a POST request from my Angular 2 frontend to my Spring backend, but I am encountering an error. The error message: GET http://localhost:8080/loginPost 405 () Failed to load http://localhost:8080/loginPost: No 'Access-Control ...

Looking to extract the expiration date from an x509 certificate?

I am currently engaged in a project that involves retrieving and displaying certificate information from an Azure integration account using Angular/Typescript. One of the requirements is to show the decoded public certificate to users to extract important ...

Is VSCode disregarding tsconfig.json and compiling individual files, causing misleading error messages to appear?

After updating typescript, angular, and all the libraries in my project, I encountered a new issue that was not present before. Although I successfully ensured that my code builds without any errors or warnings from the command line, Visual Studio Code sta ...

Angular 2 error: Unhandled Promise rejection stating that the template has parsing errors - the element 'login' is not recognized

I am currently attempting to implement Firebase Authentication login for an Angular2 project. However, I encountered the following error: Unhandled Promise rejection: Template parse errors: 'login' is not a known element: 1. If 'login&apos ...

It is not possible to use an async function with Ionic 4 ToastController buttons

Incorporating a new function into the handler of my ToastController button to return a promise (in this case: this.navCtrl.navigateForward()) is something I need assistance with. This is what my code looks like: const toast = await this.toastController.c ...

Issue with importing MomentJS globally in TypeScript

When it comes to defining global external modules in TypeScript, there is a useful option available. For instance, if you have jQuery library loaded externally, you can set up a global definition without having to include its duplicate in the TypeScript bu ...

Error message: "ExpressionChangedAfterItHasBeenCheckedError - encountered while using ngIf directive to hide/show a progress

My HTTP interceptor is set up to display a loading bar whenever an HTTP request is made: intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const dataStorageService = this.injector.get(DataStorageService); ...

Converting an array into an object in Angular for query parameters

In my Angular 12 application, I have an array of objects that I need to convert into query parameters in order to route to a generated URL. The desired query parameters should look like this: Brand:ABC:Brand:XYZ:Size:13x18:Size:51x49x85 [{ "values&q ...

Angular Validators.pattern() does not seem to function properly, despite yielding successful results in online regex testers

I have developed a regex pattern on Regex101.com and thoroughly tested it. However, when I applied it to my FormControl Validators.pattern method, it is exhibiting unexpected behavior. This regex pattern is meant for validating the Width input of a packag ...

Error in the ngx-owl-carousel-o-Angular causing disruptions in the carousel rotation

I've integrated the owl carousel into my Angular project to showcase various elements. The carousel is set to only display from 767px downwards with display:block, and above 767px it's set to display:none. However, I'm encountering a glitch ...

Exploring Angular2: Incorporating External Plugins with AngularCLI (webpack)

Currently, I am in the process of developing an Angular2 application using AngularCLI with webpack version. A third-party plugin called ScrollMagic is being utilized which comes with optional plugins of its own. The main codebase for ScrollMagic has been i ...

Discover the use of dot notation for accessing nested properties

In the deps array below, I aim to enforce type safety. Only strings allowed should be in dot notation of ${moduleX}.${moduleX service} // Modules each have a factory function that can return a services object (async) createModules({ data: { factory: ...

Is there a way to have my accordion adjust automatically?

I have developed a dynamic accordion component that populates its values from the parent component. However, I am facing an issue where each accordion does not respond individually to clicks. Whenever I click on any accordion, only the first one expands an ...

Using NgControl with a Custom Directive in Angular 2

Using ngControl on a custom component has been a challenge for me. I successfully created the component and implemented ControlValueAccessor but encountered issues with updating form classes (ng-pristine, ng-touched, ng-invalid) and checking the value of t ...

Troubleshooting issue with applying hover effect to child divs

How come when I hover over one of the child items in my parentDiv, the background of the last childDiv changes no matter which child I place my mouse on? for (let i = 0; i < Number(height); i++) { for (let j = 0; j < Number(width); j++ ...