How to fix deprecation in Ember 1.13.3

Hi everyone. I have com-switcher component which active uses controller.

{{com-switcher companies=app.companies websites=app.websites ctrl=controller}}

And on compilation get error: DEPRECATION: Using {{controller}} or any path based on it (‘builder/templates/sidebar.hbs’ @ L3:C63) has been deprecated. [deprecation id: view.keyword.controller] See Ember.js - Deprecations -template-keywords for more details.

I have tried to fix like in link example:

{{#com-switcher companies=app.companies websites=app.websites ctrl=controller as |passedData|}}
{{/com-switcher}}

And i got the same deprecation alert.

This component doesn’t have any template. All DOM structure is appended dynamically, like

didInsertElement: function() {
    this.$().append('<div>component</div>');
}

How can i fix this? How can i pass controller in proper way?

i have found how to fix this.

// template
{{com-switcher ctrl=ctrl}}

// controller
ctrl: Ember.computed(function() {
    return this;
})

Hey

I know this is long time after your post but i am updating an old ember app and I have come across the same issue , is it possible to pick your brain about it ?

Can you share more details about your code? If OP is unable to respond others might be able to chime in but it’s more difficult without any specifics about what the code in question.

Ok I have fixed this issue too i was getting the same error as shown at the top of this thread my fix (which seemed to work) was to inject the controller and use that I will share some examples once I know my fix is 100% secure and working .

Thanks again for the help

1 Like