Angular Typescript On Array.map is returning ""this.array.map is not a function"

Discussão em 'Angular' iniciado por c0micrage, Janeiro 23, 2025.

  1. c0micrage

    c0micrage Guest

    I am using Angular 6 and previous got this following to work get all the values associated with an array property.

    this.object.array.map(item => item.month).filter((value, index, self) => self.indexOf(value) === index);


    In another component, the webservice is returning an array and not an object with an embedded array. The following is throwing map() is not a function which is confusing.

    this.array.map(item => item.month).filter((value, index, self) => self.indexOf(value) === index);


    Here is the model definition of the array

    In my ts code, I declared as following

    myArrays: ArrayType[];


    in my model.ts

    export class ArrayType {

    constructor () {


    }
    public id: string;
    public name: string;
    public month: string;

    }


    Thanks

    Continue reading...

Compartilhe esta Página