← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18132: event-capture - bug fix in typeahead when both keyboard and mouse are used

 

------------------------------------------------------------
revno: 18132
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-01-27 23:51:17 +0100
message:
  event-capture - bug fix in typeahead when both keyboard and mouse are used
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js	2015-01-26 17:47:09 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/angular/plugins/dhis2/directives.js	2015-01-27 22:51:17 +0000
@@ -216,13 +216,13 @@
 .directive('d2TypeaheadValidation', function() {
     
     return {
-        require: 'ngModel',
+        require: ['typeahead', 'ngModel'],
         restrict: 'A',
-        link: function (scope, element, attrs, ctrl) {
+        link: function (scope, element, attrs, ctrls) {
             element.bind('blur', function () {                
-                if(ctrl.$viewValue && !ctrl.$modelValue){                    
-                    ctrl.$setViewValue();
-                    ctrl.$render();
+                if(ctrls[1].$viewValue && !ctrls[1].$modelValue && ctrls[0].active === -1){
+                    ctrls[1].$setViewValue();
+                    ctrls[1].$render();
                 }                
             });
         }