Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 893 Bytes

avoid-using-needs-in-controllers.md

File metadata and controls

33 lines (23 loc) · 893 Bytes

avoid-using-needs-in-controllers

✅ The "extends": "plugin:ember/recommended" property in a configuration file enables this rule.

Avoid using needs to load other controllers. Inject the required controller instead. needs was deprecated in ember 1.x and removed in 2.0.

Examples

Examples of incorrect code for this rule:

export default Controller.extend({
  needs: ['comments'],
  newComments: alias('controllers.comments.newest')
});

Examples of correct code for this rule:

import Controller, { inject as controller } from '@ember/controller';

export default Component.extend({
  comments: controller(),
  newComments: alias('comments.newest')
});

Help Wanted

Issue Link
❌ Missing native JavaScript class support #560