diosney / angular-bootstrap-datetimepicker-directive

A wrapper directive around the bootstrap-datetimepicker component.
MIT License
69 stars 50 forks source link

button doesn't show picker #24

Open joseglego opened 8 years ago

joseglego commented 8 years ago

It doesn't let you use a input-group-button to show the datetimepicker but the Eonasdan Datetimepicker lets you use it.

maxdhn commented 8 years ago

did you find a workaround ?

joseglego commented 8 years ago

Hello @MaxDhn, no I didn't. I changed to other library, and neither have this functionality. You will need:

  1. I'm using these libs:

Steps

  1. Add an input with restrictions (Using angular-datetime)
  2. Add a button which show the directive of dotfold or SimeonC

I hope it help you!

franzeal commented 8 years ago

I'm using this in Angular-Formly and was able to hook-up the button via the link function:

var input = $(el.find('input')).datetimepicker(scope.to.dateTimePickerOptions); scope.datetimepicker = input.data("DateTimePicker");

And in the template:

`

        <span class="input-group-addon" ng-click="datetimepicker.toggle()" ng-disabled="to.disabled">
            <span class="fa fa-calendar"></span>
        </span>
    </div>`

It's working fine in my application. I'm new to Angular and Bootstrap, but I would suspect you could do something similar with an additional attribute or element directive that's doing the same thing.

TinoPham commented 8 years ago

I have the same issue, How to show datetimepicker when click on icon calendar ? Please take a look at: http://eonasdan.github.io/bootstrap-datetimepicker/

IvAlex1986 commented 8 years ago

Hi @diosney, Could you fix the issue please?

IvAlex1986 commented 8 years ago

I have fixed the issue on PullRequest 32 (https://github.com/diosney/angular-bootstrap-datetimepicker-directive/pull/32). Please review my changes.

CJYate commented 7 years ago

@franzeal I don't follow completely: where do you put this code?

var input = $(el.find('input')).datetimepicker(scope.to.dateTimePickerOptions); 
scope.datetimepicker = input.data("DateTimePicker");

Is that in a script block within your page html?

franzeal commented 7 years ago

@CJBrew I've got it in a link function on a formly type that wraps this datepicker.

The type's template looks like this:

`

        <span class="input-group-addon" ng-click="datetimepicker.toggle()" ng-disabled="to.disabled">
            <span class="fa fa-calendar"></span>
        </span>
    </div>`

The link function looks like this:

link: function (scope, el, attrs, ctrl) { // Enabling the calendar button var input = (<any>$(el.find('input'))).datetimepicker(scope.to.dateTimePickerOptions); scope.datetimepicker = input.data("DateTimePicker"); },

My default options look like this (I've removed all the validation related stuff I have in here for this example):

defaultOptions: { templateOptions: { dateTimePickerOptions: { locale: 'en', format: 'MM/DD/YYYY HH:mm', showTodayButton: true, showClear: true, icons: { time: 'fa fa-clock-o', date: 'fa fa-calendar', up: 'fa fa-chevron-up', down: 'fa fa-chevron-down', previous: 'fa fa-chevron-left', next: 'fa fa-chevron-right', today: 'fa fa-dot-circle-o', clear: 'fa fa-trash', close: 'fa fa-times', }, tooltips: { clear: 'Clear Selection', close: 'Close', today: 'Now' } } } }