Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was 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

Description

@jrupac

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions