1

So I am basically trying to access the values of one of the objects within my object in my Angular code. It is a Map object and looks a bit like this

export interface CalendarEvent<MetaType = any> {
    id?: string | number;
    start: Date;
    end?: Date;
    title: string;
    color?: EventColor;
    actions?: EventAction[];
    allDay?: boolean;
    cssClass?: string;
    resizable?: {
        beforeStart?: boolean;
        afterEnd?: boolean;
    };
    draggable?: boolean;
    meta?: MetaType;
    amount: number;
    type: Map<string, string>
}

I have tried creating an NgFor which I have seen in previous solutions online like so

<p *ngFor="let item of modalData?.event.type.keys | keyvalue" >  {{item.key}} {{item.value}} </p>

I want to display the key and value pair within my line of code

Edward Muldrew
  • 253
  • 1
  • 6
  • 20
  • what do you actually want to achieve? are you facing any issue? if yes, please explain it in your Question. – Nithya Rajan Jul 05 '19 at 13:06
  • I would like to access the key value pair from the type: Map – Edward Muldrew Jul 05 '19 at 13:10
  • how the type: Map look like? can you provide some sample? – katwhocodes Jul 05 '19 at 13:50
  • Possible duplicate of [How to iterate using ngFor loop Map containing key as string and values as map iteration](https://stackoverflow.com/questions/48187362/how-to-iterate-using-ngfor-loop-map-containing-key-as-string-and-values-as-map-i) – David Jul 05 '19 at 14:22

0 Answers0