Search code examples
javascriptangularjsdatex-editable

Angular Xeditable grid set current date as default date


I'm using Angular Xeditable grid.Could you tell me how to set the curent date as default date on the calendar control which I have used within the above grid ? Thanks.

    <tr ng-repeat="comment in vm.comments track by $index">
                <td>
                    <span editable-bsdate="comment.date" e-uib-datepicker-popup="MM-dd-yyyy" e-ng-click="opened = !opened" e-is-open="opened" e-name="date" e-form="commentForm" onbeforesave="vm.checkValidity($data)" e-required>
                        {{ comment.date | date:'MM-dd-yyyy' }}
                    </span>
                </td>
      </tr>
 <button class="btn btn-primary" ng-click="vm.addComment()">Add</button>

enter image description here


Solution

  • Here it is :)

    Js

    vm.addComment = function () {
          vm.comments.push(vm.comment = {
             date: new Date()
        });
     };