ember-learn / ember-learn/guides-source

should the object model guide talk about factory registration?

Open
#144 0 comments 0 reactions 0 assignees View on GitHub
needs team discussion
Dominant language
HTML
Stars
161
Forks
512
Avg merge
4d 9h
Merged PRs (30d)
4

Description

I'd like to report a shortcoming I've noticed in the guide, and suggest adding a further-reading link between two of its pages. I don't understand the issue well enough to suggest another edit.

While adding the router service to an event-handler object (EmberObject subclass) I got the error `Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container`, which seems similar to https://stackoverflow.com/questions/34970881/inject-a-service-into-an-ember-object-not-an-ember-controller

Everything else on the event handler has been working ok with the `import` and `create` approach, but when I tried to load in the router service I hit the error.
The assert is useful, and has helped me figure out what to do next, but it seems like the guide should cover this. Instead it only talks about using `create`.

Explaining why this is needed or different from `import`/`create` would be great (maybe transcribing @locks's stackoverflow post), but it'd be simpler to put something short at the bottom of [classes and instances](https://guides.emberjs.com/release/object-model/classes-and-instances/) suggesting further reading of [dependency injection](https://guides.emberjs.com/release/applications/dependency-injection/) or even [registering singletons vs non-singletons](https://guides.emberjs.com/release/applications/dependency-injection/#toc_registering-singletons-vs-non-singletons) as further reading.

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.