I have created jQuery widget that basically adds more functionality and CSS stylings to the native jQuery UI Datepicker. I use the onSelect
option for the datepicker to update the <input>
accordingly. The problem is that even though the input changes, the model on the $scope does not change. I know I need to use $scope.$apply() in some way to notify angular that the input has changed.
I tried the following but it did not work.
this.options.onSelect = function (dateText, inst) {
$el.val(dateText);
that.$scope.$apply(); // This isn't working. I think I need to do something else
that.wrap.hide();
jQuery(document).find('.iconalt').hide();
if (that.options.afterSelect !== undefined) {
that.options.afterSelect();
}
}