Hi, I need coding help on the above subject, I posted my question on stack overflow forum, while waiting to get help there, I thought to reach out the experts on this forum too. Here is the link to my question : https://tinyurl.com/kbt7tq5
Thanks you very much for your time.
Try with replace : true in your directive options
return {
restrict: 'A',
replace : true,
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
element.datepicker({
dateFormat: 'D, d MM yy',
onSelect: function (date) {
scope.$apply(function() {
scope.deadline = date;
});
}
});
}
I haven’t tried it so there are surely different ways of achieving that. Try and let me know
Hello, thank you for your answer. I got my answer from stackoverflow a few days back, the guru suggested using
$setViewValue(value, trigger) as shown below, which works beautifully.
app.directive('jqDatePicker', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attrs, ngModelCtrl) {
$(element).datepicker({
dateFormat: 'D, d MM yy',
onSelect: function(date) {
ngModelCtrl.$setViewValue(date);
}
});
}
};
});
I will try your approach and get back to you. Thank you very much