I have a few templates/components.. like this:
display.hbs
{{my-component data=someData}}
so, my-component has in it
<div>foo</div>
{{some-other-component myData=data.blah}}
(or anything at all)
In the SomeOtherComponent.js file… myData is always undefined, no matter what I do with it/set etc
Is this common/well known and I shouldn’t bother nesting components?
Nesting components is both expected and encouraged. You can pass information through from parent to child. If you’re having issues you should try using the log helper, {{log data}}, to log out data in my-component to make sure it’s actually available and has a value in your context. Things like {{log this}} should also help when debugging your current context.
Indeed the bin is empty. Could someone else please show an example of how to do this? I tried doing this.set(‘foo’, foo) in the parent component but foo is undefined in its template, so it’s not being passed to the child component. (It is defined in the parent.)
UPDATE: I hadn’t remembered to include foo as an object member. However, it remains null in the template.