I have a JAVA Spring server, and I am trying to return a HTML page with the controller, but the problem is that I don't know what is the right way to load the page with Angular. Or maybe I am doing it wrong?
JAVA
@Controller
public class Login {
@RequestMapping(value="/login", method=RequestMethod.POST)
public @ResponseBody String testLogin(@RequestBody LoginInfo login) throws MyException{
if (login.getUser().equals("test") && login.getPass().equals("1234")){
return "main.html";
} else {
throw new MyException("Wrong login info");
}
}
AngularJS
$scope.login = function(){
url = "/login";
$http.post(url,{
"user":$scope.user,
"pass":$scope.pass
}).then(
function (response){
// what should be here???
});};