Javascript 根据datepicker的值angular.js动态更改URL

Javascript 根据datepicker的值angular.js动态更改URL,javascript,angularjs,angular-ui,angular-ui-bootstrap,Javascript,Angularjs,Angular Ui,Angular Ui Bootstrap,URL路由为: GET/admin/api/stats controllers.AdminStatsApi.getstart:Option[LocalDate],end:Option[LocalDate],computeDiff:Boolean?=false 我的问题是如何根据datepicker中输入的日期值更改URL。您提供的信息不足。你用什么?用户界面路由器$地点 但基本上你可以这样做: <label>From</label> <input type="tex

URL路由为:

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


我的问题是如何根据datepicker中输入的日期值更改URL。

您提供的信息不足。你用什么?用户界面路由器$地点

但基本上你可以这样做:

<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"/>   
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);