消费与angularJs客户Symfony2的宁静 [英] Consuming restful symfony2 with angularJs Client

查看:152
本文介绍了消费与angularJs客户Symfony2的宁静的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个使用在服务器端Symfony2中,并在angularJs客户端的应用程序。
我创建friendsofsymfony一个宁静的API,但我仍然不知道如何使用由具有角的API生成的JSON数据。我在一些教程,我可以拆分项目的两部分,所以我现在应该创建AngularJS一个简单的HTML项目中找到。但我仍然不知道我怎么可以这样!

I want create an application using symfony2 in server side and angularJs in client side. I create a restful api with friendsofsymfony but I still doesn't know how can I consume the Json data generated by the api with angular. I found in some tutorials that I can split the two part of the project and so I should now create a simple HTML project with AngularJS. But I still have no idea how can I do this!

有人可以帮我请了一些说明或例子吗?

Can someone help me please with some instructions or examples?

推荐答案

这不是那么难。这两个文件的后端和前端。

It's not so difficult. Two files backend and frontend.

后端:你应该安装symfony中,设置它,创建控制器。
在请求方法控制器设置路线(悠逸祝GET,POST,把删除)。

Backend: you should install symfony, setup it, create controller. In controller setup route with request method(for youe wish get, post, put delete).

前端:(如果你知道有点angularjs)创建主模,创建控制器和$ HTTP请求发送到您symfomy的控制器,让你的数据

Frontend: (if you know little bit angularjs) create main mod, create controller and by $http send request to your symfomy's controller and get your data.

P.S。而且不要忘了阅读串行这是这么多重要!

P.s. And don't forget read about serializer. It's so much important!!!

更多详细信息,你可以阅读这里

More detail you can read here.

这篇关于消费与angularJs客户Symfony2的宁静的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆