Return json from zend 2 to angular?

Hi there,

I read the text on the page:

I undestand that:
AngularJS $http is a core service for reading data from web servers.
$http.get(url) is the function to use for reading server data.

My php file returns data in a JSON format. To do this I used this syntax:

My problem: What if my php page is generated by controller Zend Framework 2? Should I use the same syntax as above ( $http.get(“…”) )? Is it practiced?

Any advice would be appreciated.

It doesn’t matter what framework (and even language) is used on backend to generate your JSON.
$http.get() just makes basic GET-request and reads response data.
Think about your browser. When you enter an URL it opens the page. And it doesn’t matter for browser how this page was generated (what CMS or framework the site uses).

Yes, you could use the same (with different URLs of course) for getting JSON objects,

What will be different is that the returned JSON is likely to be close to unique for every JSON object out in the wild.

You can use Angular to get JSON and Zend to send JSON and vice versus,

Each will have its own syntax but as long as the JSON is valid it should be able to be used by any code able to get and use it regardless of the language or syntax

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.