0

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?

1 Answer 1

1

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

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

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. And don't forget read about serializer. It's so much important!!!

More detail you can read here.

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you @Bakhtier Gaybulloev for your unswer. I will try to follow your advice.But what about twig and symfony routing?
More detail you can read about twing and routing combination symfony.com/doc/current/book/routing.html and here symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/…. Symfony has a perfect docs at official website. But I don't recommend you use twig in big project. Nice project should be divided to frontend and backend part.
So if I want to divide my project to frontend and backend part I will not need twig because the angular syntaxe are very similar
Yep. Plus when you will write your frontend you will use something like bower. And it will be more easy.
ok thanks a lot for your help I will try to create my frontend app now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.