如何将 Laravel 5.4 与 Angular 4 集成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43494925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:49:15  来源:igfitidea点击:

How to integrate Laravel 5.4 with Angular 4

jsonangularlaravel

提问by user7677025

I know how to create full Laravel 5.4project by its own and also I know how to create SPA using Angular 4.

我知道如何自己创建完整的Laravel 5.4项目,也知道如何使用Angular 4创建 SPA 。

Problem:

问题:

I don't know how to integrate Laravel with Angular.

我不知道如何将 Laravel 与 Angular 集成。

Also, I want to use Laravel 5.4 as the back-end and Angular 4 as the front-end.

另外,我想使用 Laravel 5.4 作为后端,使用 Angular 4 作为前端。

回答by Kyllian Vinkler

You can create two projects :

您可以创建两个项目:

  • Laravel project which provides some api's endpoint and return some json responses.
  • Angular project which calls the Laravel api in ajax and update the DOM in your front SPA with the responses.
  • Laravel 项目,它提供了一些 api 的端点并返回一些 json 响应。
  • Angular 项目,它在 ajax 中调用 Laravel api,并使用响应更新前端 SPA 中的 DOM。

回答by Ghanshyam

Other best way to integrate laravel 5.4 with Angular 4 using Angular Cli

使用 Angular Cli 将 laravel 5.4 与 Angular 4 集成的其他最佳方式

Laravel 5.4 & Angular 4.3.4

Laravel 5.4 和 Angular 4.3.4

回答by Htoo

Best way to integrate Laravel 5.4 with Angular 4

将 Laravel 5.4 与 Angular 4 集成的最佳方式

https://laravel-angular.readme.io/docs

https://laravel-angular.readme.io/docs



for existing project update some

对于现有项目更新一些

https://learninglaravel.net/angular-4-new-features-and-improvements

https://learninglaravel.net/angular-4-new-features-and-improvements