且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HTML5模式下AngularJS和Laravel 4路由冲突

更新时间:2023-02-21 17:23:44

从我读到的内容来看,当您刷新页面时,Laravel 似乎正在读取修改后的路由.在这种情况下,您应该让 Laravel 继续创建原始视图,即使它会是 404 重定向.

From what I read, it seems like Laravel is reading the modified route when you refresh the page. In this case, you should make Laravel continue to make the original view even if it would otherwise be a 404 redirect.

尝试在 Laravel 端的某处添加以下内容(例如 routes.php)

Try adding the following somewhere on the Laravel side (Ex. routes.php)

App::missing(function($exception)
{
    return View::make('index');
});

注意:您可能希望 AngularJS 的路由使用 .otherwise 来处理未找到的页面.

Note: You might want to have AngularJS's routing use .otherwise to handle pages that are not found.