Answers for "ng for key value angular"

6

ngfor on keys of a dictionary angular

<div *ngFor="let item of testObject | keyvalue">
    Key: <b>{{item.key}}</b> and Value: <b>{{item.value}}</b>
</div>
Posted by: Guest on April-30-2020
0

angular 6 key value pair getvalue example

@Component({
  selector: 'app-myview',
  template: `<div *ngFor="let key of objectKeys(items)">{{key + ' : ' + items[key]}}</div>`
})

export class MyComponent {
  objectKeys = Object.keys;
  items = { keyOne: 'value 1', keyTwo: 'value 2', keyThree: 'value 3' };
  constructor(){}
}
Posted by: Guest on May-14-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language