Я отправляю запрос
$http.get('/loadpage?category='+$scope.selectedCategory+'&page='+$scope.selectedPage).then(function(response){
}).catch(function(){
console.log("Error caught!");
});
В моем файле router.js,
У меня есть
router.get('/loadpage?category=xx&page=yy', function(req, res) {
res.send("Is this working");
});
Я не уверен, почему мой сервер показывает следующую ошибку.
angular.js: 12587 GET http://localhost:3000/loadpage?category=1&page=1 404 (не найдено)
Потому что я пытался отправить запрос на другой URL
router.get('/runthis/category=:xx',function(req, res){
var p = req.params.xx;
res.send(p);
});
от
function runthis (){
$http.get('runthis/category=smackthat').then(function(response){
console.log(response.data);
}).catch(function(){
console.log("Error caught!");
});
}
И это прекрасно работает.
Может кто-нибудь помочь. Спасибо