I have a problem I can't figure out. I wrote the back-end admin section with Laravel and Blade and added API routes for the front-end (The Angular App). I am using the yeoman angular generator, then I build the front-end project and move all the folders in "dist" into Laravel's public folder; and the index.html into /app/view/ and rename it to index.php. All loads fine but when I do an angular $http request, the response header says 200 Ok but there's no data returned. What am I missing?
/* routes.php ------------ ANGULAR.JS API ROUTES --------------- */
Route::group(['prefix'=>'client_api'], function()
{
Route::get('all-from-species', 'ClientApiController@AllFromSpecies');
Route::get('{animal}', 'ClientApiController@AnimalData');
Route::get('events', 'ClientApiController@AllEvents');
Route::post('subscribe', 'ClientApiController@subscribeToNewsletters');
Route::get('aboutus', 'ClientApiController@aboutUs');
Route::get('contactus', 'ClientApiController@contactUs');
});
ClientApiController.php -------------------------------
<?php
class ClientApiController extends \BaseController {
public function AllFromSpecies()
{
//
}
public function AnimalData($id)
{
//
}
public function AllEvents()
{
//
}
public function subscribeToNewsletters()
{
//
}
/**
* @return Response::json
*/
public function aboutUs()
{
$about = AboutUs::find(1);
// Return Json for Angular use.
return Response::json($about);
}
}
Angular JS file ----------------------------
angular.module('animalShelterApp')
.controller('AboutCtrl', function ($scope, $http) {
$http.get('/client_api/aboutus')
.then(function(response) {
$scope.aboutus = response;
});
});