TypeError: this.responsearray.find is not a function angular

Discussão em 'Angular' iniciado por Mr.M, Novembro 12, 2024.

  1. Mr.M

    Mr.M Guest

    I am getting the below error when trying to countryName in the response array.

    TypeError: this.responsearray.find is not a function


    Here is my ts code

    this is what I declared

    responsearray: any;
    editCountry(row){
    let founditem = this.responsearray.find(item => item.countryName==row);
    console.log(founditem)
    if(founditem !== undefined){
    const dialogRef = this.dialog.open(popupcomponent, {
    width: '800px',
    panelClass: 'custom-modalbox',
    disableClose: true,
    data: {pageValue:founditem}
    });

    dialogRef.afterClosed().subscribe(result => {
    console.log('The dialog was closed');
    if (!result) {
    this.loadData();
    }
    });
    }
    }


    Here is my Interface

    export interface assumption {
    countryID: number;
    CountryName: string;
    UserId: number;
    UserName: string;
    JoiningDate: String;
    BirthDate: String;
    OverallLength:number;}


    Please let me know what I am doing wrong here.

    Continue reading...

Compartilhe esta Página