angular-bootstrap-datetimepicker-directive icon indicating copy to clipboard operation
angular-bootstrap-datetimepicker-directive copied to clipboard

ng-model get not the updated value on dp.change event after selecting the picker

Open gp4pgit opened this issue 9 years ago • 2 comments

  • jquery 2.0.3
  • bootstrap 3.3.5
  • angularjs 1.4.3
  • bootstrap 3 Date/Time Picker 4.14.30

I my case the datetimepicker defined ng-model doesn't get updated values after selecting the picker...

While debugging, I noticed that in line 44 of the angular-bootstrap-datetimepicker-directive.js file ngModelCtrl.$setViewValue(e.target.value); // >>> e.target.value == undefined e.target.value is undefined... thus I changed the code to this: ngModelCtrl.$setViewValue(moment(e.date).format(default_options.format) );

This works for me... :+1: Does anyone have the same problem or what I am doing wrong?

gp4pgit avatar Jul 21 '15 17:07 gp4pgit

I have the same problem but your solution doesn't fix it, in my case.

Edit: I fixed using not $scope variable for ng-model. Using local controller variables fixed the problem for me.

mts88 avatar Sep 26 '15 16:09 mts88

I have update the angular-bootstrap-datetimepicker-directive.js file and the problem is still existing. Could someone show me a working example, please. Because my problem is, that the input textbox will be updated, but doesn't call the ng-change vm.startDatePickerDidChangeValue and doesn't update the ng-model... What am I doing wrong? ^^

<div class="input-group date"
    datetimepicker
    datetimepicker-options="{{vm.startDateTimePickerOptions}}"
    ng-change="vm.startDateTimePickerDidChangeValue()"
    ng-model="vm.startDateTimePicker">
    <input submit-required="true" type="text" class="form-control" 
        name="startDateTimePicker" id="startDateTimePicker"/>
        <span class="input-group-addon">
            <span class="glyphicon glyphicon-time"></span>
        </span>
</div>

With the following adjustment in code line 44 of the file angular-bootstrap-datetimepicker-directive.js file, which i mentioned in my first comment, it works fine for me...

ngModelCtrl.$setViewValue(moment(e.date).format(default_options.format) );

gp4pgit avatar Oct 21 '15 22:10 gp4pgit