This repository was archived by the owner on Apr 12, 2024. It is now read-only.
fix($compile): allow the usage of "$" in isolated scope property alias#15594
Closed
frederikprijck wants to merge 3 commits into
Closed
fix($compile): allow the usage of "$" in isolated scope property alias#15594frederikprijck wants to merge 3 commits into
frederikprijck wants to merge 3 commits into
Conversation
When using an alias for an isolated scope property using "$" as part of the alias, the $compile throws an exception
Error: [$compile:iscp] Invalid controller bindings definition for directive 'foo'. Definition: {... factory: '<$fooFactory' ...}
This commit removes the error by changing the regex to allow zero or one "$" character both at the beginning and the end of the alias.
Fixes: #15586
gkalpak
suggested changes
Jan 11, 2017
|
|
||
| function parseIsolateBindings(scope, directiveName, isController) { | ||
| var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/; | ||
| var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([$]?\w*[$]?)\s*$/; |
Member
There was a problem hiding this comment.
I don't think there is any harm in allowing $ anywhere in the name, so I would change [$]?\w*[$]? to [\w$]*.
Contributor
Author
There was a problem hiding this comment.
Gotta admit I was thinking the same. But I prefered to open the PR to fix only as described in the bug.
I'll fix it.
gkalpak
approved these changes
Jan 11, 2017
gkalpak
pushed a commit
that referenced
this pull request
Jan 11, 2017
Previously, when using an alias for an isolate scope or `bindings` property (e.g. `alias: '<attrName'` instead of `attrName: '<'`), a `$compile:iscp` error was thrown if the attribute name contained a "$". This commit removes the error by changing the regex to allow "$" characters in the attribute name when using a property alias. Fixes: #15586 Closes #15594
gkalpak
pushed a commit
that referenced
this pull request
Jan 11, 2017
Previously, when using an alias for an isolate scope or `bindings` property (e.g. `alias: '<attrName'` instead of `attrName: '<'`), a `$compile:iscp` error was thrown if the attribute name contained a "$". This commit removes the error by changing the regex to allow "$" characters in the attribute name when using a property alias. Fixes: #15586 Closes #15594
ellimist
pushed a commit
to ellimist/angular.js
that referenced
this pull request
Mar 15, 2017
Previously, when using an alias for an isolate scope or `bindings` property (e.g. `alias: '<attrName'` instead of `attrName: '<'`), a `$compile:iscp` error was thrown if the attribute name contained a "$". This commit removes the error by changing the regex to allow "$" characters in the attribute name when using a property alias. Fixes: angular#15586 Closes angular#15594
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
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, ...)
Bug
What is the current behavior? (You can also link to an open issue here)
When using an alias for an isolated scope property using "$" as part of the alias, the $compile throws an exception
Fixes: #15586
What is the new behavior (if this is a feature change)?
This commit removes the error by changing the regex to allow zero or one "$" character both at the beginning and the end of the alias.
Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements
Other information: