0
votes

In ember 2.0, I am not able to wrap controller in my-component. it is showing compilation error. Assertion Failed: Using {{controller}} or any path based on it has been removed in Ember 2.0.

{{my-component ctrl=controller}}

How to achieve this ?. please guide me for alternative solution.

2

2 Answers

1
votes

You should use component actions which bubble to controller or passing controller properties in template declaration, if you need to access data from controller, instead of using {{controller}} directive.

0
votes

You just shouldn't do that. You should only pass in the properties that are relevant for the component instead of the whole controller.

For example if your component needs the properties foo and bar that are defined in the controller than you have to add them to your component call like {{my-component componentAttribute=foo anotherAttribute=bar}}. If you have to use the properties in some nested components you have to pass the properties in the most top level component and then pass it down to the component you want to make use of them.