How can I use Angular 2 in PHP application?

前端 未结 4 1953
长情又很酷
长情又很酷 2020-12-13 19:36

I am a PHP developer and I started learning Angular2. But I don\'t know how to use it with PHP. Is it possible using Angular just as frontend? What I must to do? How to use

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 20:26

    Preferably, your site will just download a simple index.html and a file called app.js which contains all of your JS and therefore your Angular app.

    PHP will be sitting on a server doing the job of an API, which is answering with JSON/XML to request, you angular app will then use the JSON to build the web interface.

    You can have PHP hosted anywhere, and serve your angular app from another place, even thought it's not recommended because of latency

    
      
    
                                     
                  
    提交回复
热议问题