简体   繁体   中英

AngularJS and Laravel 4 controllers, multi page app

This question is regarding best practices and application architecture for Laravel 4 and AngularJS

Is it advisable to create an RESTful application in Laravel 4 that serves a blade template for each "section" or "area" of the application and provides and API to access RESTful JSON data within these areas calling AngularJS pratials. Or is it better to serve as a single page AngularJS application.

A better description would be calling a "DashbaordController@get" controller method and serving a larvel blade template from here. then the rest of the dashboard "area" is handled by AngularJS and its partial templates through a RESTful JSON API in the DashboardController.

It all depends on what you want to do.

SPA: You could create a master.blade.php and use angulars routing. This way you only need to specify the resource in laravel and call it inside angular.

Not spa: Use laravel to create the routes and let laravel create the views. You only need to create different view templates, which hold references to your angular controllers.

Partial SPA: You could route everything past domain.com/admin through angular.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM