angular-bootstrap-datetimepicker-directive
angular-bootstrap-datetimepicker-directive copied to clipboard
ng-model get not the updated value on dp.change event after selecting the picker
- 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?
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.
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) );