lundi 4 décembre 2017

how to marry laravel and angularjs routing

I have an angularjs (version 5) app running in laravels public folder. angularjs should serve the ui aka frontend. whilst laravels "only" route is the backend api access to the data(base) serving the ui at /api/.... How do I marry both?

My angularjs app resides in /public/ui/ so I currently just have a route in laravel like so:

Route::get('/', function () {
    return Redirect::to('/ui/dist');
});

This works partially. It works from within the angularjs app like expected. But when I call anuglarjs routes they will fail to display because of course they don't exist in laravel. Going with the angularjs tutorial for example: If I call /ui/dist/heroes it will display a 404 instead of the angularjs app.

Note: Laravels public folder is symlinked to the webroot.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire