我在想 点击时间控件后,该时间参数能够带到url中 0 0。。。有什么方法?求教。。找了好久了
走同样的路,发现不同的人生
Isn’t it enough to manually add the parameters in the time control to the url? . .
Take a look at the example
<body ng-app="MyApp"> <h1>Time Show</h1> <p ng-controller="MyController as vm"> <input type="time" ng-model="vm.time"/> <button ng-click="vm.change()">添加参数到url</button> </p> <script> angular.module('MyApp',[]) .controller('MyController', MyController); MyController.$inject = ['$http','$location']; function MyController($http, $location){ var vm = this; vm.change = change; vm.params = { time: '3600' // 这里你可能要对你获取到的时间做一下处理,我就简单写一下. }; function change(){ console.log(vm.time); var url = 'https://api.github.com/users'; $http.get(url, {params: vm.params}) .then(function(res){ console.log(res); }) } } </script> </body>
I don’t know if this is what you think. After you get the time, you need to interact with the backend, and the time is a query parameter.
Isn’t it enough to manually add the parameters in the time control to the url? . .
Take a look at the example
I don’t know if this is what you think. After you get the time, you need to interact with the backend, and the time is a query parameter.