javascriptangulardata-sharing

Passing object from parent to child returning object name as string angular


When ever I try to pass object from parent to child I get variable name as string.

editData

note this edit data should return exactly as the object above it in the pic.

I am using a ViewChildin child component to get data from parent.

message="editData"

<app-add-user-form message="editData" (showUserForm)="hideUserForm($event)" (submitUsersData)="pushToArray($event)"></app-add-user-form>

stack bliz link


Solution

  • You're not binding to the property. Use square bracket notation to bind the property to your model.

    [message]="editData"