Typeahead does not support "group by" or "track by" syntax #506
Description
It seems that the regex used to parse the typeahead
expression has gotten out of sync with the syntax available in the select
directive. I can see that keeping these in sync could be an ongoing challenge as there doesn't seem to be an easy way to extract the regex and parser from select
. Perhaps the correct long-term fix is for AngularJS to extract the parser for select
into a reusable service and have typeahead use that directly.
In the short-term, perhaps the typeahead regex and parser can be updated to at least add support for the "group by" syntax, which can be useful, I think. In general, I think it is a great idea to re-use the exact same syntax as select
.
Here are the details. The select
directive's ng-options
attribute allows a "group by" clause:
select as label group by group for value in array
OR
select as label group by group for (key, value) in object
(from: http://docs.angularjs.org/api/ng.directive:select)
However, it seems that typeahead does not parse for the "group by" syntax:
Also, recently a "track by" syntax was added:
The relevant lines in the current AngularJS source where the regex is defined:
... and where the syntax is parsed using the regex above: