From: Dobrica Pavlinusic Date: Fri, 11 Jan 2013 16:42:49 +0000 (+0100) Subject: bsTypeahead directive which adds entered value back X-Git-Tag: 0.4~1 X-Git-Url: http://git.rot13.org/?p=angular-drzb;a=commitdiff_plain;h=c9057e46f3dde2278b5ee0921c27d1ec7b8a10ea bsTypeahead directive which adds entered value back --- diff --git a/app/drzb2013.html.ep b/app/drzb2013.html.ep index 53bb577..6951fa8 100644 --- a/app/drzb2013.html.ep +++ b/app/drzb2013.html.ep @@ -66,7 +66,6 @@ --> - diff --git a/app/js/app.js b/app/js/app.js index 03179c9..2533351 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -2,7 +2,7 @@ // Declare app level module which depends on filters, and services -angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives', '$strap.directives' ]). +angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives' ]). config(['$routeProvider', function($routeProvider) { $routeProvider.when('/registration/:registrationId', {templateUrl: 'partials/registration.html', controller: RegistrationCtrl}); $routeProvider.when('/confirmation/:registrationId', {templateUrl: 'partials/confirmation.html', controller: RegistrationCtrl}); diff --git a/app/js/directives.js b/app/js/directives.js index 2aa3a9c..cac0c3c 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -18,10 +18,62 @@ angular.module('myApp.directives', []). var my_type = attrs['type'] || 'text'; var html = '
' +'' - +'' - +'
' + +' 1 && $.inArray( new_value, value ) === -1 ) { // IE doesn't have .indexOf + scope.$apply( function() { + value.unshift( element.val() ); + }); + } + }); + + } + }; +}]) +;