I'm new to AngularJS and having a hard time getting it to work smoothly with Laravel. I am trying to create a back-end application for a website and want the routes prefixed with '/admin' to all be managed by AngularJS without the hash in the URL.
Laravel's Back-end
Routes
Route::group(['prefix' => 'admin'], function()
{
Route::get('/', function() {
return View::make('backend/dashboard');
});
});
View - dashboard.blade.php
<!doctype html>
<html ng-app="glenn">
<head>
<title>Laravel and Angular Together</title>
<meta charset="utf-8">
<base href="/admin">
<script src="vendor/angular.js"></script>
<script src="vendor/angular-route.js"></script>
<script src="js/app.js"></script>
</head>
<body>
<h1>Dashboard</h1>
<div class="container">
<ng-view></ng-view>
</div>
</body>
</html>
AngularJS Front-end
app.js
var glenn = angular.module('glenn', ['ngRoute']);
glenn.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/test', {
templateUrl: 'test.html',
controller: 'TestController'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
});
glenn.controller('TestController', function($scope) {
});
Problem: when I direct the browsers url to admin/test, then I receive Laravel's NotFoundHttpException because Laravel is trying to take over the routes that I want Angular to take care of...how can I fix this? Thanks