@sorvah wrote:
I have a nested component that is stubbornly refusing to give me access to a property in the component.js file and I don’t know why.
The component is a few layers down as follows:
{{component-1 myProperty=aSecondModel}} --{{component-2 myProperty=myProperty}} ---{{component-3 myProperty=myProperty}} ----{{component-4 myProperty=myProperty}}
Note that the above components also have other properties being passed through them but I hope that illustrates the structure.
In the template of component 4 I have access to myProperty and I can use it (for example, with an {{#each}} helper but I would like to perform some tasks on it within the component.js
I thought I could access it with
this.get(‘myProperty’)
However I keep getting ‘cannot read property ‘get’ of undefined’ errors. I get this whether I try to add it as a variable or try to add a new property to Component.extend. I can’t even
console.log(this.get('myProperty))
without getting the error.What am I missing in trying to access this piece of information?
Posts: 5
Participants: 2