简体   繁体   中英

Angular2 not getting value if using Jquery Datepicker

I am trying to use datepicker as:

<div class="form-group row">
                        <label class="col-md-3 col-form-label" for="l0">Date</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control datepicker-only-init" formControlName="last_updated" placeholder="Select Date" />
                        </div>
                    </div>

in ts:

$(function(){
        $('.datepicker-only-init').datetimepicker({
            widgetPositioning: {
            horizontal: 'left'
            },
            icons: {
            time: "fa fa-clock-o",
            date: "fa fa-calendar",
            up: "fa fa-arrow-up",
            down: "fa fa-arrow-down",
            previous: 'fa fa-arrow-left',
            next: 'fa fa-arrow-right'
            },
            format: 'LL'
        });
    })

** My Datepicker displays well but I am unable to get its value again.

I am getting it as ;

this.testForm.controls['last_updated'].value;

我找到了一个解决方案:

<input type="text" class="form-control datepicker" id="datePicker" #datePicker formControlName="last_updated" placeholder="Select Date" (blur)="onDateChange(datePicker.value);"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM