0

When I pass object to child component from parent - it comes converted to string

<m-tank-add fuelTypes="{{this.fuelTypes}}" count="{{count}}"></m-tank-add>
 @Input() fuelTypes: Array<FuelTypeModel>;
 @Input() count: number;

count comes as "5" and fuelTypes as "[object Object],[object Object],[object Object],[object Object],[object Object]"

How can I pass parameters so they wouldn't be converted to string?

Tatyana
  • 231
  • 1
  • 5
  • 15

1 Answers1

2

You should be using property binding through square brackets since with interpolation value is stringified:

[fuelTypes]="fuelTypes"

See also:

yurzui
  • 205,937
  • 32
  • 433
  • 399