문제

<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"/>   
.

URL 경로는 다음과 같습니다.

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

내 질문은 datepicker에 입력 된 날짜 (값)에 따라 URL을 변경할 수있는 방법입니다.

도움이 되었습니까?

해결책

정보가 충분하지 않았습니다.당신은 무엇을 사용합니까?UI-Router?$ location?

그러나 기본적으로 당신은 그런 식을 할 수 있습니다 :

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);
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top