javascript - Change URL dynamically depending on datepicker's value angular.js -
<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 :
get /admin/api/stats controllers.adminstatsapi.get(start: option[localdate], end: option[localdate], computediff: boolean ?= false)
my question how can change url depending on date (value) entered in datepicker
.
you have given insufficient information. use? ui-router? $location?
but can that:
var changeurl = function(startdate, enddate){ //do url change whatever thing using change url } $scope.$watch('startdate', function(newvalue){ var start = newvalue; var end = $scope.enddate; //do url change here changeurl(start, end); }, true); $scope.$watch('enddate', function(newvalue){ var start = $scope.startdate; var end = newvalue; //do url change here changeurl(start, end); }, true);
Comments
Post a Comment