momentjsangular-daterangepicker

How to set initial(default) value in moment dateTimePicker with AngularJS


i'm very much new to angular and using this DateTimePicker by moment.js. i'cant figure out how to set the default value well in my case it is {{z.startDate}} and is not Displaying there. So How to set that default value and make it binded with ng-model.

<div ng-repeat="(key,z) in x.data">
    <input class="form-control" ng-model="z.startDate" ng-model-options="{ updateOn: 'blur' }" change="onDateChange(newValue, oldValue)" placeholder="Select a date..." value="z.startDate" moment-picker="ctrl.input" format="L">
</div>

Solution

  • We just need to pass an moment object to a particular control while working with moment controls. Moment object does not render any other values.

    startDate = moment();