Created
March 8, 2014 09:35
-
-
Save ishanray/9427896 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('timePicker', function(){ | |
return { | |
restrict: 'A', | |
replace: true, | |
scope: { | |
time: '=' | |
}, | |
templateUrl: 'js/partials/time-picker.html', | |
link: function(scope, el, attr){ | |
var hideDropDown = function() { | |
scope.showTimeDropdown = false; | |
scope.$apply(); | |
}; | |
el.bind('click', function(e){ | |
if (e.target.nodeName === 'INPUT'){ | |
scope.showTimeDropdown = true; | |
scope.$apply(); | |
} else if (e.target.nodeName === 'LI'){ | |
var time = angular.element(e.target).html(); | |
scope.time = time; | |
hideDropDown(); | |
} | |
}); | |
el.bind('mouseleave', function(){ | |
hideDropDown(); | |
}); | |
} | |
} | |
}); //end of timepicker directive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment