{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3350","labels_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3350/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3350/comments","events_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3350/events","html_url":"https://github.com/angular-ui/bootstrap/issues/3350","id":59464095,"number":3350,"title":"Invalid iteration parsing for typehead","user":{"login":"VitalyTomilov","id":5108906,"avatar_url":"https://avatars.githubusercontent.com/u/5108906?v=3","gravatar_id":"","url":"https://api.github.com/users/VitalyTomilov","html_url":"https://github.com/VitalyTomilov","followers_url":"https://api.github.com/users/VitalyTomilov/followers","following_url":"https://api.github.com/users/VitalyTomilov/following{/other_user}","gists_url":"https://api.github.com/users/VitalyTomilov/gists{/gist_id}","starred_url":"https://api.github.com/users/VitalyTomilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VitalyTomilov/subscriptions","organizations_url":"https://api.github.com/users/VitalyTomilov/orgs","repos_url":"https://api.github.com/users/VitalyTomilov/repos","events_url":"https://api.github.com/users/VitalyTomilov/events{/privacy}","received_events_url":"https://api.github.com/users/VitalyTomilov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-ui/bootstrap/labels/component:%20typeahead","name":"component: typeahead","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-02T10:36:35Z","updated_at":"2015-03-02T10:50:46Z","closed_at":null,"body":"From the library code below, RegEx that's used restricts your data binding to attributes only:\r\n\r\n````\r\n/**\r\n * A helper service that can parse typeahead's syntax (string provided by users)\r\n * Extracted to a separate service for ease of unit testing\r\n */\r\n  .factory('typeaheadParser', ['$parse', function ($parse) {\r\n\r\n  //                      00000111000000000000022200000000000000003333333333333330000000000044000\r\n  var TYPEAHEAD_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w\\d]*))\\s+in\\s+([\\s\\S]+?)$/;\r\n\r\n  return {\r\n    parse:function (input) {\r\n\r\n      var match = input.match(TYPEAHEAD_REGEXP);\r\n      if (!match) {\r\n        throw new Error(\r\n          'Expected typeahead specification in form of \"_modelValue_ (as _label_)? for _item_ in _collection_\"' +\r\n            ' but got \"' + input + '\".');\r\n      }\r\n\r\n      return {\r\n        itemName:match[3],\r\n        source:$parse(match[4]),\r\n        viewMapper:$parse(match[2] || match[1]),\r\n        modelMapper:$parse(match[1])\r\n      };\r\n    }\r\n  };\r\n}])\r\n````\r\n\r\nI have dictionaries of data to be linked against using the standard angular syntax of:\r\n````\r\n\"(key, value) as value in data\"\r\nwhere\r\ndata={\r\n  key1: \"val1\",\r\n  key2: \"val2\",\r\n  etc...\r\n}\r\n````\r\n\r\nThe above restriction makes it very akward, so I need to transform dictionary values somehow before I can use it. There is no reason why dictionaries cannot be used for typeheads. We just need to fix the code above, somehow.\r\n\r\nAny idea how to make it work?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/angular-ui/bootstrap/issues/comments/76691671","html_url":"https://github.com/angular-ui/bootstrap/issues/3350#issuecomment-76691671","issue_url":"https://api.github.com/repos/angular-ui/bootstrap/issues/3350","id":76691671,"user":{"login":"karianna","id":180840,"avatar_url":"https://avatars.githubusercontent.com/u/180840?v=3","gravatar_id":"","url":"https://api.github.com/users/karianna","html_url":"https://github.com/karianna","followers_url":"https://api.github.com/users/karianna/followers","following_url":"https://api.github.com/users/karianna/following{/other_user}","gists_url":"https://api.github.com/users/karianna/gists{/gist_id}","starred_url":"https://api.github.com/users/karianna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karianna/subscriptions","organizations_url":"https://api.github.com/users/karianna/orgs","repos_url":"https://api.github.com/users/karianna/repos","events_url":"https://api.github.com/users/karianna/events{/privacy}","received_events_url":"https://api.github.com/users/karianna/received_events","type":"User","site_admin":false},"created_at":"2015-03-02T10:50:46Z","updated_at":"2015-03-02T10:50:46Z","body":"plunkr please"}}