: -
<li>
<a ng-click="givequiz()">GiveQuiz</a>
</li>
및 내 각 코드는 다음과 같습니다. -
$scope.givequiz=function(){
console.log("give quiz");
$http.get('/home/givequiz').then(function(res){
//request is going fine and all
});
}
위의 작업은 효과가 있지만 개체로 응답을 받고 있습니다. 전체 파일과 URL이 변경되지 않았습니다.
하지만 난 양식 GET 일 할 경우 : -이 새로운 URL로 저를 필요
<li>
<form action="http://localhost:8000/home/givequiz" method="GET">
<button type="submit">Give Quiz</button>
</form>
</li>
"http://localhost:8000/home/givequiz" 전화를하지만, $ http.get하지 왜 그렇게입니다합니까? 두 가지 방법이 동일하지 않습니까? 이것이 바로 두 요청을 처리하는 방법입니다.
router.get('/givequiz', function(req, res, next) {
console.log("in getquiz");
//always gets printed^means all reqs come here
res.sendFile('/givequiz.html',{ root: client });
});
Any help will be much appreciated.
처음에는 경로를 수동으로 변경해야합니다. –