Skip to content

Commit

Permalink
docs(Readme): Update Date Range picker example in the readme and add …
Browse files Browse the repository at this point in the history
…it to the demo page.

The original example did not have code to re-render the directive when the start or end date

changed. It is now a more complete example.

Fix #315
  • Loading branch information
dalelotts committed Sep 13, 2016
1 parent 9c3d569 commit 3de0d25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ the drop-down is toggled closed after the user selectes a date/time.
### Create a date range picker with validation controls
```html
<div class="dropdown form-group">
<label for="dateRangeStart">Start Date</label>
<label>Start Date</label>
<a class="dropdown-toggle" id="dropdownStart" role="button" data-toggle="dropdown" data-target="#"
href="#">
<div class="input-group date">
<input id="dateRangeStart" type="text" class="form-control" data-ng-model="dateRangeStart">
<input type="text" class="form-control" data-ng-model="dateRangeStart">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
</a>
Expand All @@ -358,7 +358,7 @@ the drop-down is toggled closed after the user selectes a date/time.
</div>

<div class="dropdown form-group">
<label for="dateRangeStart">End Date</label>
<label>End Date</label>
<a class="dropdown-toggle" id="dropdownEnd" role="button" data-toggle="dropdown" data-target="#"
href="#">
<div class="input-group date">
Expand All @@ -385,12 +385,10 @@ $scope.startDateBeforeRender = startDateBeforeRender
$scope.startDateOnSetTime = startDateOnSetTime

function startDateOnSetTime () {
selectable = (!selectable);
$scope.$broadcast('start-date-changed');
}

function endDateOnSetTime () {
selectable = (!selectable);
$scope.$broadcast('end-date-changed');
}

Expand Down
2 changes: 0 additions & 2 deletions demo/demo-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@
}

function startDateOnSetTime () {
selectable = (!selectable);
$scope.$broadcast('start-date-changed');
}

function endDateOnSetTime () {
selectable = (!selectable);
$scope.$broadcast('end-date-changed');
}

Expand Down
6 changes: 3 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ <h4>Every time you select a start date, dates before the start date are disabled

<div class="well">
<div class="dropdown form-group">
<label for="dateRangeStart">Start Date</label>
<label>Start Date</label>
<a class="dropdown-toggle" id="dropdownStart" role="button" data-toggle="dropdown" data-target="#"
href="#">
<div class="input-group date">
<input id="dateRangeStart" type="text" class="form-control" data-ng-model="dateRangeStart">
<input type="text" class="form-control" data-ng-model="dateRangeStart">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
</a>
Expand All @@ -430,7 +430,7 @@ <h4>Every time you select a start date, dates before the start date are disabled
</div>

<div class="dropdown form-group">
<label for="dateRangeStart">End Date</label>
<label>End Date</label>
<a class="dropdown-toggle" id="dropdownEnd" role="button" data-toggle="dropdown" data-target="#"
href="#">
<div class="input-group date">
Expand Down

1 comment on commit 3de0d25

@dalelotts
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixes #330

Please sign in to comment.