Answers for "different ways to loop objects in Angular 11"

2

iterate object ngfor

// In your ts file
Object = Object;

// then in the template:

<div *ngFor="let key of Object.keys(objs)">
   my key: {{key}}
   my object {{objs[key] | json}} <!-- hier I could use ngFor again with Object.keys(objs[key]) -->
</div>
Posted by: Guest on December-14-2020
3

loop through object typescript

// This solution is for when you want to use 
// `break`, `return` which forEach doesn't support
for (const key in tempData) {
      if (tempData.hasOwnProperty(key)) {
        // your logic here
      }
}
Posted by: Guest on August-11-2020

Code answers related to "different ways to loop objects in Angular 11"

Code answers related to "Javascript"

Browse Popular Code Answers by Language