diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js index a2c7d5e2ce..b0a2baca0e 100644 --- a/src/typeahead/test/typeahead.spec.js +++ b/src/typeahead/test/typeahead.spec.js @@ -68,7 +68,7 @@ describe('typeahead tests', function () { toBeClosed: function () { var typeaheadEl = findDropDown(this.actual); this.message = function () { - return 'Expected "' + angular.mock.dump(this.actual) + '" to be closed.'; + return 'Expected "' + angular.mock.dump(typeaheadEl) + '" to be closed.'; }; return typeaheadEl.css('display') === 'none' && findMatches(this.actual).length === 0; @@ -588,6 +588,12 @@ describe('typeahead tests', function () { changeInputValueTo(element, 'ba'); expect($document.find('body')).toBeOpenWithActive(2, 0); }); + + it('should not append to body when value of the attribute is false', function () { + var element = prepareInputEl('
'); + changeInputValueTo(element, 'ba'); + expect(findDropDown($document.find('body')).length).toEqual(0); + }); }); }); \ No newline at end of file diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 8b1dba873e..5dfecbcae7 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -57,7 +57,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap var inputFormatter = attrs.typeaheadInputFormatter ? $parse(attrs.typeaheadInputFormatter) : undefined; - var appendToBody = attrs.typeaheadAppendToBody ? $parse(attrs.typeaheadAppendToBody) : false; + var appendToBody = attrs.typeaheadAppendToBody ? originalScope.$eval(attrs.typeaheadAppendToBody) : false; //INTERNAL VARIABLES