diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js index e93d5e18b7..81a01ec3f7 100644 --- a/src/typeahead/test/typeahead.spec.js +++ b/src/typeahead/test/typeahead.spec.js @@ -363,6 +363,21 @@ describe('typeahead tests', function () { expect(inputEl.val()).toEqual('Alaska'); }); + + it('issue 863 - it should work correctly with input type="email"', function () { + + $scope.emails = ['foo@host.com', 'bar@host.com']; + var element = prepareInputEl("
"); + var inputEl = findInput(element); + + changeInputValueTo(element, 'bar'); + expect(element).toBeOpenWithActive(1, 0); + + triggerKeyDown(element, 13); + + expect($scope.email).toEqual('bar@host.com'); + expect(inputEl.val()).toEqual('bar@host.com'); + }); }); describe('input formatting', function () { diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index df55c8b2d4..f230862f75 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -143,7 +143,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position']) //plug into $parsers pipeline to open a typeahead on view changes initiated from DOM //$parsers kick-in on all the changes coming from the view as well as manually triggered by $setViewValue - modelCtrl.$parsers.push(function (inputValue) { + modelCtrl.$parsers.unshift(function (inputValue) { resetMatches(); if (inputValue && inputValue.length >= minSearch) {