ember-learn / ember-learn/guides-source

Example in guide suggests accessing controller in route, which causes linter error

Open
#1,590 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
161
Forks
512
Avg merge
4d 9h
Merged PRs (30d)
4

Description

The example on [Preventing Transitions via willTransition](https://guides.emberjs.com/release/routing/preventing-and-retrying-transitions/#toc_preventing-transitions-via-willtransition) is using `this.controller` from inside route `willTransition`. This behaviour is flagged as error [ember/no-controller-access-in-routes](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-controller-access-in-routes.md) by es-lint.

```
error Do not access controller in route outside of setupController/resetController ember/no-controller-access-in-routes
```
Is there a better (not discouraged) way to implement the example? Or should the linter take this use case into account?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.