Laravel 5 AngularJS html5Mode
发布时间:2020-12-17 10:20:47 所属栏目:安全 来源:网络整理
导读:我正在使用Laravel 5和AngularJS开发一个项目.我想启用 $locationProvider.html5Mode(true); 并停止重新加载页面.当我将其设置为false并访问链接时,页面不会重新加载. 这是我的route.php Route::get('/',function () { return View::make('index'); }); 角度
我正在使用Laravel 5和AngularJS开发一个项目.我想启用
$locationProvider.html5Mode(true); 并停止重新加载页面.当我将其设置为false并访问链接时,页面不会重新加载. 这是我的route.php Route::get('/',function () { return View::make('index'); }); 角度代码 app.config(function($routeProvider,$locationProvider) { $routeProvider.when('/',{ templateUrl: 'views/feed.html',controller: 'fdController' }).when('/collections',{ templateUrl : 'views/collections.html',controller: 'clController' }).otherwise({ redirectTo : '/' }); $locationProvider.html5Mode(true); }); 当我访问链接html5Mode(false) 当html5Mode(true)和我访问
我改变了我的route.php
Route::get('/',function () { return View::make('index'); }); Route::get('{all}',function () { return View::make('index'); }); 并添加了一个基数< base href =“/”>到我的index.php现在一切正常,页面不刷新. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读