<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"/>
网址路径为:
GET /admin/api/stats controllers.AdminStatsApi.get(start: Option[LocalDate], end: Option[LocalDate], computeDiff: Boolean ?= false)
我的问题是如何根据datepicker
中输入的日期(值)更改网址。
答案 0 :(得分:0)
您提供的信息不足。你用什么? UI的路由器? $位置?
但基本上你可以这样做:
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);