Angular 17 encountered a select error in core.mjs at line 6531 showing an unexpected synthetic listener error with code NG05105: @transformPanel.done

My select option is not working properly and I keep getting an error in the console that says:

  • To resolve this issue, make sure to import either BrowserAnimationsModule or NoopAnimationsModule in your application.

Here's my Typescript code:

import { Component } from '@angular/core';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { DatePipe } from '@angular/common';
import { MatListModule } from '@angular/material/list';
import { MatSelectModule } from '@angular/material/select';
import { MatTooltipModule } from '@angular/material/tooltip';
import { provideAnimations } from '@angular/platform-browser/animations'; 
import { MatFormFieldModule } from '@angular/material/form-field';
import { FormsModule } from '@angular/forms';

export interface legend {
  name: string;
  image: string;
  tooltip: string;
}
export interface maplist {
  name: string;
  legends: Array<legend>
}

@Component({
  selector: 'app-legend',
  standalone: true,
  imports: [MatListModule, MatIconModule, MatDividerModule, DatePipe,
    MatSelectModule, MatTooltipModule, MatFormFieldModule, FormsModule, 
  ],
  providers: [
    provideAnimations()
  ],
  templateUrl: './legend.component.html',
  styleUrl: './legend.component.css',
})
export class LegendComponent {
  selectedValue: Array<legend> = [];

  maplistdata: maplist[] = [
    {
      name: "Echocondria",
      legends: [
        {
          name: "House",
          image: "",
          tooltip: "Living quarters for the residents."
        },
        {
          name: "Shop",
          image: "",
          tooltip: "Places to buy and sell goods."
        },
      ]
    },
    {
      name: "Echocondria Sewers",
      legends: [
        {
          name: "House",
          image: "",
          tooltip: "Living quarters for the residents."
        },
        {
          name: "Shop",
          image: "",
          tooltip: "Places to buy and sell goods."
        },
      ]
    },
  ]
}

Here's my HTML code:

<mat-form-field>
  <mat-label>Select an option</mat-label>
  <mat-select 
    color="primary"
    [(ngModel)]="selectedValue" name="legendselect"
  >
    <mat-option>None</mat-option>
    @for (legend of maplistdata; track legend) {
        <mat-option [value]="legend.legends">{{legend.name}}</mat-option>
    }
   </mat-select>
  </mat-form-field>

  @for (legenditem of selectedValue; track legenditem) {
  <mat-list-item>
  <mat-icon matListItemIcon>folder</mat-icon>
  <div matListItemTitle [matTooltip]="legenditem.tooltip"><img class="legendIcon" [src]="legenditem.image"/> {{ legenditem.name }}</div>
   <div matListItemLine>{{legenditem.tooltip}}</div>
</mat-list-item>
  }

I've already tried importing the required modules but still facing the same error or duplicates. Any advice would be appreciated.

Answer №1

The function provideAnimations() should be placed at the core of your application. You can either include it in the configuration of boostrapApplication, or if you are using an AppModule, make sure to import BrowserAnimationsModule.

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

Guide to dynamically configuring ViewEncapsulation for a Web Component

When initializing a component, I am facing an issue with setting up Shadow DOM based on the browser type (since IE does not support Shadow DOM). To handle this, I check if the browser is IE11 and then configure the encapsulation as Emulated for IE and Sha ...

String defines the type

I came across the following code snippet in some external sources that I intend to incorporate into my project: const INIT: 'jsonforms/INIT' = 'jsonforms/INIT' Can someone explain what it means to define a type with a string like INIT ...

Is it possible to integrate multiple instances of Mat Paginator within a single component?

After encountering issues with the Mat Table / Mat Paginator due to an ngIf in my HTML file, I had to readjust the component. The standard paginator convention didn't work as expected because of delayed data arrival. Below is the updated typescript th ...

Encountering a lack of XHRBackend provider when using Angular 2 and Http service

My current project is being built using angular2 (angularcli generated), webpack, scss, and module-oriented architecture. For handling HTTP requests, I opted to create a Service that is utilized by an Authentication service. All of this is referenced wit ...

How to use D3 to add arrow directions to an SVG path

Within my svg path lies the representation of a shuttle track used in manufacturing processes. Every shuttle on this track moves in a distinct direction, and I wanted the svg path to visually indicate these directions for easy reference. Initially, I tried ...

The Angular user interface is failing to update in accordance with the list obtained from the HTTP GET request made to the .Net Core API

Currently, I am working on an application that utilizes Angular for the frontend and .Net Core API 3.0 for the backend. My objective is to display a list of clients using the Angular Material grid. In my OnInit() method, I invoke my getAllClients service t ...

Finding the perfect pairing: How to align counters with objects?

public counter = 0; x0: any; x1: any; x2: any; x3: any; x4: any; next(){ this.counter += 1; this.storage.set("Count", this.counter); console.log(this.counter); this.logic(); } logic(){ //automatic counter here var xNum = JSON.parse(JSON.stri ...

How can I ensure that TypeORM, Type GraphQL, Apollo Server, and Azure Functions work together seamlessly?

I have an Azure Function written in TypeScript that utilizes various technologies such as TypeORM, Apollo Server, and TypeGraphQL. The function involves creating resolvers for projects and tasks and establishing a database connection. import { createConne ...

Creating input fields in Angular 2

Can someone guide me on how to sum the values entered in two input fields? Here is my HTML code snippet. I'm not sure if there's anything missing in the ts file. <div class="small-7 columns"> <md-input-container> <input t ...

What is the best way to transform the data stored in Observable<any> into a string using typescript?

Hey there, I'm just starting out with Angular and TypeScript. I want to get the value of an Observable as a string. How can this be achieved? The BmxComponent file export class BmxComponent { asyncString = this.httpService.getDataBmx(); curr ...

How can I prevent an Angular 2+ app from loading until the APP_INITIALIZER has completed its execution?

While I have managed to call a service before the root component loads, I am struggling to find a way to make the whole app wait until the service completes successfully. Essentially, I am looking for a way to make it a synchronous call. The service is loa ...

Angular view showcasing a JSON array

After retrieving data from the Laravel API, I used the following method: this.dataService.getData().subscribe(res=>{ this.contacts=res }); Upon receiving a JSON array response from Laravel like the one below, I attempted to iterate throu ...

Advantages of passing individual variables instead of the entire object from HTML to JavaScript in AngularJS

When it comes to passing the iterating object from HTML to Javascript, there are two approaches that can be taken. The first approach involves passing the iterating object as a whole, while the second approach only passes the required properties of the obj ...

Choosing Angular.json setups while executing a Docker multi-stage construction

I am currently in the process of developing an Angular6 application with a Docker multistage build. The default angular.json file generated by angular.cli includes a build section containing various configurations. To choose a specific configuration, I can ...

Incorporating npm packages into an Angular2 (v2.0.0-rc.1) application

Struggling with integrating npm libraries into my Angular2 app has been a challenge, especially when trying to include https://github.com/manfredsteyer/angular2-oauth2. Every time I try to import the library, I encounter a 404 error. Even after adding the ...

Is it possible to dynamically assign a CSS class to a DOM element during a drag operation while the mouse button is held down?

I am currently working on developing a unique pathfinder visualizer. My progress so far includes creating a grid of size 16x45 using the function below: export const drawBoard = () => { const boardContainer: HTMLDivElement | null = document.querySelec ...

What is the best way to implement record updates in a nodejs CRUD application using prisma, express, and typescript?

Seeking to establish a basic API in node js using express and prisma. The schema includes the following model for clients: model Clients { id String @id @default(uuid()) email String @unique name String address String t ...

External node modules written in TypeScript can occasionally be transpiled into both `module.exports` and `

Currently, I am in the process of transforming my node application to utilize TypeScript external modules. While everything runs smoothly when executing the app, I encountered an issue with my mocha tests "exploding" after converting some of my .ts files d ...

When I include formControlName in Angular, the select dropdown loses its default value

I seem to be facing an issue with my select element. When I include the formControlName, the placeholder "-- Select Event Type --" no longer appears (even though it is still selected in the dropdown). If I remove it, the placeholder displays but the valida ...

Trouble displaying JSON data in HTML using *ngFor in Angular

Just starting out with angular and I've created a services class that returns product details in JSON format. api.service.ts import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import 'rxjs/add/ ...