Skip to content

Instantly share code, notes, and snippets.

@dbajpeyi
Created October 24, 2013 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dbajpeyi/7134692 to your computer and use it in GitHub Desktop.
Save dbajpeyi/7134692 to your computer and use it in GitHub Desktop.
AngularJS timepicker directive
appDirective.directive('timePicker',function(){
return {
restrict : 'E',
require: ['ngModel'],
scope :{
ngModel: '='
},
replace: true,
template:
'<div class="input-group bootstrap-timepicker">' +
'<input type="text" class="form-control" ngModel>' +
'<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i>' +
'</div>',
link: function(scope, element, attrs){
var input = element.find('input');
input.timepicker('showWidget');
element.bind('blur keyup change', function(){
scope.ngModel = input.val()
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment