How to iterate using ngFor loop Map containing key as string and values as map iteration

前端 未结 6 1586
孤独总比滥情好
孤独总比滥情好 2020-12-02 10:51

I am new to angular 5 and trying to iterate the map containing another map in typescript. How to iterate below this kind of map in angular below is code for component:

6条回答
  •  有刺的猬
    2020-12-02 11:18

    As people have mentioned in the comments keyvalue pipe does not retain the order of insertion (which is the primary purpose of Map).

    Anyhow, looks like if you have a Map object and want to preserve the order, the cleanest way to do so is entries() function:

    • key: {{item[0]}} value: {{item[1]}}

提交回复
热议问题