Laravel路由没有捕获我的angular $ http.get函数

时间:2014-07-30 15:15:38

标签: angularjs laravel

我开始构建一个带有Laravel后端和AngularJS前端的应用程序。一切都在游泳,所以我不能得到我的路线文件拿起mt $ http获取请求。它只返回get中的基本URL(“/”),但是当我在其中添加动词时根本不起作用。

这是我的app.js AngularJS文件,它发出请求:

function TodoCtrl($scope, $http) {
$http.get("/laravel-old/here").success(function(todos) {
    $scope.todos = todos;
});

$scope.remaining = function() {
    var count = 0;
    angular.forEach($scope.todos, function(todo) {
        count += todo.done ? 0 : 1;
    });
}
}

这是我的路线档案:

<?php
Route::get('/', function()
{
    return View::make('hello');
});

Route::get("todos", function() {
    return Todo::all();
});

Route::get("here", function() {
    return "upi are here";
});
?>

第一个路由(“/”)工作正常并返回我想要的任何内容,但当我将get请求更改为其他两个中的一个时,如下所示:

http.get("/laravel-old/here").success(function(todos) {

这个没有被拿起来,我得到了:

404 Not Found1ms    
angular.min.js (line 78)
"NetworkError: 404 Not Found - http://localh**t/laravel-old/here"

我的Laravel安装位于我服务器上名为“laravel-old”的子文件夹中。这可能与它有关吗?

感谢

0 个答案:

没有答案