Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ngOptions in <select> does not support free-style code #5602

Closed
jrupac opened this issue Jan 2, 2014 · 0 comments
Closed

ngOptions in <select> does not support free-style code #5602

jrupac opened this issue Jan 2, 2014 · 0 comments

Comments

@jrupac
Copy link
Contributor

jrupac commented Jan 2, 2014

As of 1.2.6, the parser accepts multiline string in ng-repeat. However, the same does not exist for ng-options in elements. The current regex for matching ng-options is: var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/ Following the same pattern to fix #5000, the new regex could be: var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\r\n\s\S]*?)(?:\s+track\s+by\s+(.*?))?$/ In the above, [\r\n\s\S] is added after in\s+(, replacing the . there. However, I have not tested the above change. There may be other elements that also support iteration and don't allow multiline strings that I missed too.

@ghost ghost assigned tbosch Jan 3, 2014
jrupac added a commit to jrupac/angular.js that referenced this issue Jan 4, 2014
This patch allows the ng-options value of a <select> element to span
multiple lines, which would previously throw an error when used with filters.

Closes angular#5602
jrupac added a commit to jrupac/angular.js that referenced this issue Jan 4, 2014
Update the regexp grouping comment to reflect the changes needed for
multiline expressions in ng-options for <select>.

Closes angular#5602
jeffbcross pushed a commit that referenced this issue Jan 10, 2014
Update the regexp grouping comment to reflect the changes needed for
multiline expressions in ng-options for <select>.

Closes #5602
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
This patch allows the ng-options value of a <select> element to span
multiple lines, which would previously throw an error when used with filters.

Closes angular#5602
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
Update the regexp grouping comment to reflect the changes needed for
multiline expressions in ng-options for <select>.

Closes angular#5602
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
This patch allows the ng-options value of a <select> element to span
multiple lines, which would previously throw an error when used with filters.

Closes angular#5602
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
Update the regexp grouping comment to reflect the changes needed for
multiline expressions in ng-options for <select>.

Closes angular#5602
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants