Angular chained typeaheads break with whitespace

  angular, angular-ui-bootstrap, typeahead

Given two entries with typeaheads, one chained to the other (selection in the first determines choicelist for the second), there seems to be an issue with values containing whitespace, even though the entries are linked by id, not display value.

The behaviour is best shown in a demo: JSFiddle

To reproduce:

  1. select an object in the first typeahead
  2. select an object in the second typeahead, see that it works
  3. select the object named broken in the first typeahead
  4. try to select an object in the second typeahead, there is no choicelist available

The id of the object selected in the first entry determines the choicelist of the second. However, if there is a space at the end of the name of the selected object, the second typeahead breaks.

If you were to remove the space at the end of Broken , the second entry starts working as expected.

This seems like a bug to me, since the display value of the first entry should play no part in the second.

Am I wrong?

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.