luisfarzati/ng-bs-daterangepicker — pull request #18 by yisraeldov (2014-03-24 21:36:17+00:00)
Title: Updating the original model with new start and end date

This will also update the parent scope.

I had `$scope.dateRange` bound to a service so that date range was shared though my app. Changing the range in the date picker was not updating the bound service, only the local model.

```` javascript
//service for passing around date range
services.factory('DateRange',function($location){
console.debug("New dateRange");
var dateRange = {
endDate:moment($location.search().to),
//default to MTD
startDate:$location.search().from?moment($location.search().from):moment().startOf('month')
}
console.debug(dateRange.startDate.format())
return dateRange;
})
````

and in my controller

```` javascript
$scope.dateRange = DateRange
````

And in the view template

```` html

````

There is probably a better way to do this, but now I can change the date range and have it available to my whole application.