0

I am using one template for my project which provide a class named input-datepicker , by applying this class name on input element ,popup of datepicker gets open .

When i use same class inside ng-repeat it doesn't work. What would be your advice about this problem ? I have used directives also

var app=angular.module('module', []).directive("datepicker", function () {
 function link(scope, element, attrs) {
    // CALL THE "datepicker()" METHOD USING THE "element" OBJECT.
    element.datepicker({
        // dateFormat: "dd/mm/yy"
    });
 }
 return {
    require: 'ngModel',
    link: link
 };
})

Note : the input field where im applying the class is inside modal. Below Html COde:

<div ng-repeat="x in array">
  <input type="text" class="form-control input-datepicker" ng-mode="user.date" />

Nerdy Sid
  • 332
  • 5
  • 14
  • can you show the html code? – Agam Banga May 01 '17 at 12:09
  • Don't waste your time implementing the jQuery datepicker, use the [native version](http://angular-ui.github.io/bootstrap/#!#datepicker) of datepicker – Alon Eitan May 01 '17 at 12:12
  • But 80% of the project has the jquery Datepicker – Nerdy Sid May 01 '17 at 12:20
  • @SiddheshMishra Ok, so in your HTML you're binding all the dates to the same model `user.date` you should bind it to `x.date` for example – Alon Eitan May 01 '17 at 12:22
  • Oh shoot, it was supposed to be duplicate of http://stackoverflow.com/questions/43609770/dynamic-addition-of-div-using-ng-repeat-in-angularjs/43610175. – Alon Eitan May 01 '17 at 12:24
  • @SiddheshMishra `ng-mode` should be `ng-model` and then you have to manually update `ng-model` value on datepicker change event, you can refer [this answer](http://stackoverflow.com/a/29194068/2435473), though it is datetimepicker. – Pankaj Parkar May 01 '17 at 12:31
  • @AlonEitan no..if i use x.date ..then too it is not popping up – Nerdy Sid May 01 '17 at 12:32
  • @PankajParkar Sir sorry for my wrong spell...i am in hurry so did that – Nerdy Sid May 01 '17 at 12:33

0 Answers0