A
A
Anatoly Zaporozhets2017-12-22 20:42:03
Angular
Anatoly Zaporozhets, 2017-12-22 20:42:03

How should angular2+ communicate with the server?

They gave a test task for the vacancy of Junior Frontend Developer. Single-page cloud-storage application on angular 2+, with authorization, the ability to create directories, upload files, etc. The backend was told to do what I want (I'm going to php)
Before that, I'm not at all in angular in the tooth with my foot. I kind of read the angular documentation, wrote mini applications that can take data from a local file. Well, the problem is that I can’t figure out the syntax for sending requests and receiving responses (and even more so for sending files).
Before that, I wrote everything simply using js, jquery (and a little experience in react) and everything worked through cdn. And Angular requires assembly, and everything is complicated by the fact that each time you have to build the application with the ng build --prod command and transfer it to the local server folder.
How to make Angular friends with PHP scripts located on the server and responsible for storing files and accessing the database. As I understand it, php scripts should give data at the end of the script, something like this echo json_encode ($ datar); But what about the client side?
PS Until you understand Angular, it only complicates everything, as it seems to me.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question