This is a migrated thread and some comments may be shown as answers.

AngularJS masked datepicker

1 Answer 257 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
SLM
Top achievements
Rank 1
SLM asked on 09 Aug 2016, 09:36 AM

Hello,

I'm attempting to create a masked datepicker using AngularJS.

I tried something like this, but it's not working :

 

<input kendo-date-picker
k-mask="00/00/0000"
k-options="{format: 'dd/MM/yyyy'}"
ng-model="vm.Filters.ToDate" />

Do you have a dojo of the solution ?

 

Thank you.

1 Answer, 1 is accepted

Sort by
0
SLM
Top achievements
Rank 1
answered on 09 Aug 2016, 09:47 AM

Found a solution/workaround :

JavaScript :

mainApp.directive('maskedDatePicker', [function () {
    return {     
        link: function (scope, elem, attrs) {
            $(elem).kendoMaskedTextBox({
                mask: "00/00/0000"
            });
            $(elem).removeClass("k-textbox");
        }
    }
}]);

html :

<input masked-date-picker
kendo-date-picker
k-options="{format: 'dd/MM/yyyy'}"
ng-model="vm.Filters.ToDate"/>

Tags
Date/Time Pickers
Asked by
SLM
Top achievements
Rank 1
Answers by
SLM
Top achievements
Rank 1
Share this question
or