Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember init failing to recognize _super

So my app has this component.js:

import Component from '@ember/component';
import layout from './template';
export default class MyComponent extends Component {
    layout = layout;

    init() {
        this._super(...arguments);
    }
}

When the component is rendered I am getting this error in the chrome console:

Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <savings-toolkit@component:my-component::ember2445> to call `this._super(...arguments);` from `init`.

The content is not loaded. I wish I could say more, but seriously, what the heck?

Yes, it was initially more much content when I started. It is, however, at this time, literally nothing more than the above.

like image 613
The E Avatar asked Dec 11 '22 03:12

The E


1 Answers

No one's answering, but I found the answer.

If you are using classes, ie export default class myComponent extends Component as opposed to the old way (export default Component.extend) you shouldn't use this._super. Instead, you use the super keyword:

super.init(...arguments);

like image 137
The E Avatar answered Jan 14 '23 11:01

The E