11/**
22 * AngularStrap - Twitter Bootstrap directives for AngularJS
3- * @version v0.6.2 - 2013-01-17
3+ * @version v0.6.3 - 2013-01-25
44 * @link http://mgcrea.github.com/angular-strap
55 * @author Olivier Louvignes
66 * @license MIT License, http://www.opensource.org/licenses/MIT
@@ -203,7 +203,7 @@ angular.module('$strap.directives')
203203
204204 iElement . on ( 'click.button.data-api' , function ( ev ) {
205205 scope . $apply ( function ( ) {
206- controller . $setViewValue ( $ ( ev . target ) . attr ( 'value' ) ) ;
206+ controller . $setViewValue ( $ ( ev . target ) . closest ( 'button' ) . attr ( 'value' ) ) ;
207207 } ) ;
208208 } ) ;
209209
@@ -429,7 +429,6 @@ angular.module('$strap.directives')
429429
430430} ] ) ;
431431
432-
433432angular . module ( '$strap.directives' )
434433
435434. directive ( 'bsModal' , [ '$parse' , '$compile' , '$http' , '$timeout' , '$q' , '$templateCache' , function ( $parse , $compile , $http , $timeout , $q , $templateCache ) {
@@ -453,7 +452,7 @@ angular.module('$strap.directives')
453452
454453 // Build modal object
455454 var id = getter ( scope ) . replace ( '.html' , '' ) . replace ( / \/ / g, '-' ) . replace ( / \. / g, '-' ) + '-' + scope . $id ;
456- var $modal = $ ( '<div></div>' ) . attr ( 'id' , id ) . attr ( 'tabindex' , - 1 ) . addClass ( 'modal hide fade' ) . html ( template ) ;
455+ var $modal = $ ( '<div></div>' ) . attr ( 'id' , id ) . attr ( 'tabindex' , - 1 ) . attr ( 'data-backdrop' , element . attr ( 'data-backdrop' ) || true ) . attr ( 'data-keyboard' , element . attr ( 'data-keyboard' ) || true ) . addClass ( 'modal hide fade' ) . html ( template ) ;
457456 $ ( 'body' ) . append ( $modal ) ;
458457
459458 // Configure element
@@ -797,7 +796,6 @@ angular.module('$strap.directives')
797796
798797} ] ) ;
799798
800-
801799angular . module ( '$strap.directives' )
802800
803801. directive ( 'bsTypeahead' , [ '$parse' , function ( $parse ) {
@@ -821,7 +819,7 @@ angular.module('$strap.directives')
821819
822820 element . attr ( 'data-provide' , 'typeahead' ) ;
823821 element . typeahead ( {
824- source : function ( query ) { return value ; } ,
822+ source : function ( query ) { return angular . isFunction ( value ) ? value . apply ( null , arguments ) : value ; } ,
825823 minLength : attrs . minLength || 1 ,
826824 items : attrs . items ,
827825 updater : function ( value ) {
@@ -850,8 +848,10 @@ angular.module('$strap.directives')
850848
851849 // Support 0-minLength
852850 if ( attrs . minLength === "0" ) {
853- setTimeout ( function ( ) { // Push to the event loop to make sure element.typeahead is defined
854- element . on ( 'focus' , element . typeahead . bind ( element , 'lookup' ) ) ;
851+ setTimeout ( function ( ) { // Push to the event loop to make sure element.typeahead is defined (breaks tests otherwise)
852+ element . on ( 'focus' , function ( ) {
853+ setTimeout ( element . typeahead . bind ( element , 'lookup' ) , 200 ) ;
854+ } ) ;
855855 } ) ;
856856 }
857857
0 commit comments