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
feat($controller): throw error when requested controller is not regis… #15015
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…tered Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller did not yield a function. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes angular#14980
3 tasks
|
||
This error occurs when the {@link ng.$controller `$controller()`} service is called | ||
with a string that does not match any of the registered controllers. The controller service may have | ||
been invoked directly, or indirectly through the {@link ng.ngController `ngController`} directive, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add "for example through...", because the list is non-exhaustive.
(E.g. a route definitions for ngRoute
or ui.router
and possibly ngMaterial
instantiate controllers as well under the hood.)
A couple of minor comments. |
I've made the changes you noted, and also removed the test for ngController. As the $controller service can be used by many different services, we would have to test all of them, which is tedious duplication. |
LGTM |
Narretz
added a commit
that referenced
this pull request
Aug 17, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes #14980 PR (#15015)
petebacondarwin
pushed a commit
to petebacondarwin/angular.js
that referenced
this pull request
Nov 21, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes angular#14980 PR (angular#15015)
petebacondarwin
pushed a commit
to petebacondarwin/angular.js
that referenced
this pull request
Nov 21, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes angular#14980 PR (angular#15015)
petebacondarwin
pushed a commit
to petebacondarwin/angular.js
that referenced
this pull request
Nov 21, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes angular#14980 PR (angular#15015)
petebacondarwin
pushed a commit
to petebacondarwin/angular.js
that referenced
this pull request
Nov 21, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes angular#14980 PR (angular#15015)
petebacondarwin
pushed a commit
to petebacondarwin/angular.js
that referenced
this pull request
Nov 21, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes angular#14980 PR (angular#15015)
petebacondarwin
pushed a commit
that referenced
this pull request
Nov 23, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes #14980 PR (#15015)
petebacondarwin
pushed a commit
that referenced
this pull request
Nov 24, 2016
Previously, it would throw the ng:areq error, which is less specific and just informs that the requested controller is not defined. Given how commonly controllers are used in Angular, it makes sense to have a specific error. The ng:areq error is still thrown when the registered controller is not a function. Closes #14980 PR (#15015)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
docs
What is the current behavior? (You can also link to an open issue here)
when a requested controller is not found (not registered), then a pretty non-descriptive ng:areq error is thrown
What is the new behavior (if this is a feature change)?
a new error is thrown
Please check if the PR fulfills these requirements
Other information:
…tered
Previously, it would throw the ng:areq error, which is less
specific and just informs that the requested controller did
not yield a function. Given how commonly controllers are used
in Angular, it makes sense to have a specific error.
The ng:areq error is still thrown when the registered controller
is not a function.
Closes #14980