Question

<label>From</label>
<input type="text" datepicker-popup="dd-MM-yyyy" ng-model="StartDate"/>
<label>To</label>
<input type="text" datepicker-popup="dd-MM-yyyy" ng-model="EndDate"/>   

The URL route is :

GET /admin/api/stats controllers.AdminStatsApi.get(start: Option[LocalDate], end: Option[LocalDate], computeDiff: Boolean ?= false)

My question is how can I change the URL depending on the date (value) entered in the datepicker.

Was it helpful?

Solution

You have given insufficient information. What do you use? ui-router? $location?

But basically you can do something like that:

var changeUrl = function(startDate, endDate){
  //do url change with whatever thing you are using to change your url
}

$scope.$watch('StartDate', function(newValue){
   var start = newValue;
   var end = $scope.endDate;

   //do your url change here
   changeUrl(start, end);
}, true);


$scope.$watch('EndDate', function(newValue){
   var start = $scope.startDate;
   var end = newValue;

   //do your url change here
   changeUrl(start, end);
}, true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top