Normally, AngularJS has reponsibility to consume data from API service or API provider using any XHR method such as $http, $resource, and so on. but I want to use AngularJS acting as API service or API provider on client side. For example
I has JSON data store in AngularJS's variable:
{
id: 1,
firstname: "user1"
}
Normal situation:
- user type url "http://localhost/#/user" via browser or PostMan(Chrome's Add-on)
The result show (content type "text/html")
<html> <head> <script src="...angular.js"></script> </head> <body> <pre> { id: 1, firstname: "user1" } </pre> </body> </html>
Prefer situation and output:
- user type url "http://localhost/#/user" via browser or PostMan(Chrome's Add-on)
The result shown (content type "application/json"):
{ id: 1, firstname: "user1" }
Does AngularJS can do like my prefer above?