module Sfx { export class DateTimePickerDirective implements ng . IDirective { public restrict = "E" ; public controller = DateTimePickerController ; public controllerAs = "ctrl" ; public templateUrl = "partials/date-time-picker.html" ; public scope = { ngModel : "=" , minDate : "=?" , maxDate : "=?" , initDate : "=?" , readOnly : "=?" , placeHolderText : "=?" , } ; public link ( $scope , element , attributes ) { $scope . initDate = $scope . initDate || new Date ( ) ; $scope . readOnly = $scope . readOnly || true ; $scope . placeHolderText = $scope . placeHolderText || "" ; $scope . formats = [ "dd-MMMM-yyyy" , "yyyy/MM/dd" , "dd.MM.yyyy" , "shortDate" ] ; $scope . format = $scope . formats [ 0 ] ; } } export class DateTimePickerController { public static $inject = [ "$scope" ] ; public constructor ( private $scope ) { } public popupClick ( event ) { event . stopPropagation ( ) ; this . $scope . opened = ! this . $scope . opened ; } public popupFocus ( event ) { if ( ! this . $scope . opened ) { this . $scope . opened = true ; } } } }