Angularjs How to clear angularjs-bootstrap-datepicker -


on click of reset button i'm trying clear form fields i'm unable clear angular-bootstrap-datepicker.this code

<div class="form-group">     <label class="col-sm-3 control-label">strting, ending date</label>     <div class="col-sm-7">         <div class="input-group" style="width: 45%;float: left;">             <input class="fa fa-calendar" id="dpstartdate" name="startdate" type="text" data-ng-datepicker data-ng-options="datepickeroptions" ng-model="job.startdate">         </div>         <div class="input-group" style="width: 45%;float: right;">             <input class="form-control" id="dpenddate" name="enddate" type="text" data-ng-datepicker data-ng-options="datepickeroptions" ng-model="job.enddate">         </div>     </div> </div> <button class="btn" ng-click="clearfields()" style="margin-left: 8px">reset</button>  $scope.datepickeroptions = {                             format: 'mm/dd/yyyy',                             language: 'en',                             autoclose: true,                             weekstart: 0                         } 

i have made number of unsuccessful attempts like

$scope.job = {},(all fields other 2 datepickers become blank) $scope.job.startdate = '' $scope.job.startdate = null 

this seems issue specific version of ui-bootstrap library. have here. can replace library latest 1 rid of issue. have apprehensions regarding other code , not intent replace library, can try following hack.

provide identifier <input> element of datepicker , set model null below

angular.element("#strtdate")[0].value = null;

this worked me. hope helps too.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -