D
D
Dmitry Sokolov2016-06-08 10:28:55
Yii
Dmitry Sokolov, 2016-06-08 10:28:55

How to make a get request for a Yii2 action from an angular application and get a response?

Good afternoon!
1. Is all interaction between the client based on angular and the server based on yii2 built through the restful api, or can a request be made from the client to any regular controller / action and get a response?
2. If the answer to the first question is yes, then how to execute get requests for action on yii from the client and receive answers.
The task is to work with the model in yii2. Made implementation on the client, but it would be more correct to make it on the server. But I can't figure out how to pass the parameters through the rest get and get answers.
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Bovyrin, 2016-06-08
@sbovyrin

Angular http module implement works with REST requests

V
VitGun, 2016-06-08
@VitGun

Look at the series of articles. Just your case.
Yii2: Simple application with AngularJS frontend

D
Dmitry Sokolov, 2016-06-08
@Dm-Sok

Along the way, more questions arose:
1. Is it possible to make the client part of the application in the Yii template in order to be able to use the usual yii controllers and actions, and not just the restful api.
2. Does it make sense to transfer all get requests from the current url from the client to the server and work with the model there, if I get the url itself with $location.search(); As I understand it, it's easier to do everything on the client in terms of application speed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question