1
<textarea [ngModel]="offers" formControlName="offers" 
           class="form-control" rows="3">
</textarea>

where offers is an array. It returns output [object Object] . How to displayed it as a JSON format??

Ajay
  • 4,773
  • 3
  • 23
  • 36
Mehadi Hassan
  • 1,160
  • 1
  • 13
  • 33

2 Answers2

0

If offers is an array of single object than use

<textarea [value]="offers[0] | json" formControlName="offers" 
           class="form-control" rows="3">
</textarea>

if offers is an object than use

<textarea [value]="offers | json" formControlName="offers" 
           class="form-control" rows="3">
</textarea>

I hope it helps.

Ajay
  • 4,773
  • 3
  • 23
  • 36
0

If you want to show data only then do simply like this.

 <textarea [ngModel]="offers[0] | json" formControlName="offers" class="form- 
 control" rows="3"></textarea>

offers is an array thats why you should have to add like this 'offers[0]'

Aniket kale
  • 609
  • 7
  • 23