This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Factory that doesn't return an object silently inject null #4575
Comments
👍 |
We could take it a step further and throw a minErr if the factory function doesn't return something which isn't null/false/undefined, how does that sound? Ditto for the provider itself, I guess Throwing a minErr is a pretty trivial patch to write, unfortunately using the $log service within the injector is less easy. This may not be totally possible to do without throwing. And throwing unfortunately breaks some tests (the rethrow mock provider returns no value, and I can't find where it's actually defined -_-) shrug. I guess this could possibly break a bunch of apps anyways, so maybe it's better not to bother until 1.3 |
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Sep 22, 2014
BREAKING CHANGE: Previously, not returning a value would fail silently, and an application trying to inject the value owuld inject an undefined value, quite possibly leading to a TypeError. Now, the application will fail entirely, and a reason will be given. Closes angular#4575
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Sep 22, 2014
BREAKING CHANGE: Previously, not returning a value would fail silently, and an application trying to inject the value owuld inject an undefined value, quite possibly leading to a TypeError. Now, the application will fail entirely, and a reason will be given. Closes angular#4575
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Sep 22, 2014
BREAKING CHANGE: Previously, not returning a value would fail silently, and an application trying to inject the value owuld inject an undefined value, quite possibly leading to a TypeError. Now, the application will fail entirely, and a reason will be given. Closes angular#4575
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Sep 22, 2014
BREAKING CHANGE: Previously, not returning a value would fail silently, and an application trying to inject the value owuld inject an undefined value, quite possibly leading to a TypeError. Now, the application will fail entirely, and a reason will be given. Closes angular#4575
bullgare
pushed a commit
to bullgare/angular.js
that referenced
this issue
Oct 9, 2014
BREAKING CHANGE: Previously, not returning a value would fail silently, and an application trying to inject the value owuld inject an undefined value, quite possibly leading to a TypeError. Now, the application will fail entirely, and a reason will be given. Closes angular#4575 Closes angular#9210
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Factory that return null instead of an object silently inject null object:
Example:
http://plnkr.co/edit/SJM7yZafOxV0Vu6peLQL?p=preview
ACTUAL: no errors on console, $scope.name set to api not injected
EXPECTED: some sort of console warning with a useful error for newbies
The text was updated successfully, but these errors were encountered: