2

I have datepicker ,in which i want to configure initDate so that if model value is null then datepicker show default selected date. Here is the HTML:

<span class="input-group">
      <input type="text" id="input_empdob"  ng-readonly="isEmployeeRelieved" readonly placeholder="mm/dd/yyyy" min="mindobDate" max="maxdobDate" ng-change="setYearOfPassing(); setJoiningDate();" class="form-control" datepicker-popup="{{format}}" ng-model="employee.dob" datepicker-options="dateOptions" is-open="emp_dob_opened" ng-required="true" close-text="Close" name="input_empdob"/>
             <span class="input-group-btn">
                   <button class="btn btn-default" ng-click="open($event); emp_dob_opened = true;"><i class="glyphicon glyphicon-calendar"></i></button>
             </span>

and in controller i have configured datepicker-options like:

$scope.dateOptions = {
            'init-date': new Date(1991,01,02)
        };

at first time while loading it behaves fine, but when on save, when i clear model value then it does not show initDate properly as configured.

Thanks for any help.

3
  • what do you mean by after clearing model, it does not show initDate? Commented Mar 18, 2015 at 7:54
  • 1
    There is an outstanding issue with a pull request pending here issue2331 Commented Mar 18, 2015 at 8:04
  • @pankajparkar when i clear employee.dob it should show 1991-01-02 as default selected date,but it doesn't. Commented Mar 18, 2015 at 10:23

1 Answer 1

1

I tried to use it too, didn't work.

so, i am using the initialization with the model.

in my controller i set it like:

$scope.initialDate: $filter('date')(new Date(), 'dd/MM/yyyy');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.