【发布时间】:2014-07-19 13:33:39
【问题描述】:
我有这个角码
var loginApp = angular.module('login', []);
loginApp.controller('loginCtrl', function($scope, $http)
{
$scope.password = "";
$scope.email = "";
$scope.doLogin = function()
{
if($scope.password.trim() != "" && this.isEmailValid())
{
$http.get('/AuthLogin')
.success(function(response)
{
console.log(response);
})
.error(function(error)
{
alert(error);
});
}
}
});
这里是 laravel routes.php:
<?php
Route::get('/AuthLogin', function()
{
return 'success';
});
App::missing(function($exception)
{
Blade::setContentTags('<%', '%>'); // for variables and all things Blade
Blade::setEscapedContentTags('<%%', '%%>'); // for escaped data
return View::make('index');
});
?>
问题是我将主根/ 页面作为$http.get 的响应而不是“成功”。为什么?
谢谢!
【问题讨论】:
-
尝试添加斜线:$http.get('//AuthLogin')
-
@IlyasMimouni 我收到一个错误:GET authlogin net::ERR_NAME_NOT_RESOLVED
-
好的,直接在导航器中尝试:localhost/AutoLogin。如果这不起作用,那么问题就在路线上。
-
还是一样。谁让问题变成了 angular 或 laravel?
-
我认为它可以在 IE 中工作,但不能在 Firefox 或 chrome 中,所以请尝试 post 中的方法。
标签: javascript php angularjs laravel routing