Datepicker jQuery

1

I have a problem with Datepicker of jQuery-UI, when selecting the date the event is not executed (change), my application is made in AngularJS 4, and when the date is modified, it executes a method in my class, but with datepicker I can not execute it.

I tried with $(this).trigger('change') ; but this only looks for a JavaScript function to execute and not the Angular method.

What I'm looking for is how to execute (if you can) an Angular function from jQuery, or how to notify ngModel that I modified a jQuery object.

If someone has an idea of what I can do, I am very grateful.

public inicializaDatepicker() {
    $('#datepicker').datepicker({
      showOn: "focus",
      autoSize: this.tamanioAuto,
      dateFormat: this.formato,
      changeMonth: this.mesEnCombo,
      changeYear:  this.anioEnCombo,
      yearRange: this.anioMin + ':' + this.anioMax,
      onSelect: function (dateText, inst) {
        this.valor = dateText;
        this._value = dateText;
        console.log('SELECCIONADO --> this.valor: ',this.valor, ' --> this._value: ',this._value, '--> #datepicker: ', $('#datepicker').datepicker('getDate'));
        }
    }).trigger('change');
}
    
asked by aℓۼҳ 14.05.2018 в 23:16
source

0 answers