1

I have a snippit as follows to try to pass a property down to a child element as follows:

<dom-repeat items="{{employees}}" as="employee">
  <template>
    <child-element employee={{employee}}> </child-element> 
  </template>
</dom-repeat>

Where employee is of type array (taken from the Polymer tutorial).

employees: {
   type: Array,
   notify: true,
   value() {
      return [
        {first: 'Bob', last: 'Smith'},
        {first: 'Sally', last: 'Johnson'},
      ];
    }

In my child element, I'm just attempting to print out the passed down property:

<div> <span> {{employee}} </span> </div>

where employee is defined as a

employee: {
    type: String,
    notify: true,
    value: "",
},

However, the values are not passed down when I try to print them out. If I change the value of employee to something else, it gets printed. Why is that? I cannot figure out why that property isn't passed down?

Thank you.

1 Answer 1

0

Turns out it does work. The problem might have been passing down the entire object to the child element. Changed to only passing the String:

<child-element employee={{employee.first}}> </child-element> 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.