Created
          March 29, 2015 03:56 
        
      - 
      
 - 
        
Save Adamwaheed/99ff5d790baae8509749 to your computer and use it in GitHub Desktop.  
    Date Picker Directives
  
        
  
    
      This file contains hidden or 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('mbDatepicker', function() { | |
| 'use strict'; | |
| return { | |
| restrict: 'AE', | |
| replace:true, | |
| scope :{ | |
| mbModel : '=', | |
| mbDpConfig: '=', | |
| label : '@', | |
| mbId: '=' | |
| }, | |
| template : '<div class="dropdown">'+ | |
| '<md-input-container>'+ | |
| ' <label>{{label || \'Date\'}}</label>'+ | |
| ' <input id="{{mbId}}" ng-model="mbModel" click-anywhere-but-here ng-focus="showdatepicker = true" tabindex="1">'+ | |
| '</md-input-container>'+ | |
| '<ul class="dropdown-menu noselect" role="menu" aria-labelledby="dLabel" ng-show="showdatepicker" >'+ | |
| ' <datetimepicker data-ng-model="mbModel" data-datetimepicker-config="mbDpConfig || \'\'" on-set-time="showdatepicker = false;" />'+ | |
| '</ul>'+ | |
| '</div>', | |
| link : function (scope, element, attrs) { | |
| scope.mbId = attrs.mbId; | |
| $(element).find('input').bind('focus',function () { | |
| scope.showdatepicker = true; | |
| scope.$apply(scope.showdatepicker); | |
| }); | |
| $(element).bind('blur', function(){ | |
| scope.showdatepicker = false; | |
| scope.$apply(scope.showdatepicker); | |
| }); | |
| } | |
| }; | |
| }); | 
      
      
  Author
  
  
      
          
      
      
            Adamwaheed
  
      
      
      commented 
        Mar 29, 2015 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment