{"action":"opened","issue":{"url":"https://api.github.com/repos/zhanglianxin/ngstudy/issues/7","repository_url":"https://api.github.com/repos/zhanglianxin/ngstudy","labels_url":"https://api.github.com/repos/zhanglianxin/ngstudy/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/zhanglianxin/ngstudy/issues/7/comments","events_url":"https://api.github.com/repos/zhanglianxin/ngstudy/issues/7/events","html_url":"https://github.com/zhanglianxin/ngstudy/issues/7","id":228221204,"number":7,"title":"Using a RESTful client","user":{"login":"zhanglianxin","id":9329713,"avatar_url":"https://avatars0.githubusercontent.com/u/9329713?v=3","gravatar_id":"","url":"https://api.github.com/users/zhanglianxin","html_url":"https://github.com/zhanglianxin","followers_url":"https://api.github.com/users/zhanglianxin/followers","following_url":"https://api.github.com/users/zhanglianxin/following{/other_user}","gists_url":"https://api.github.com/users/zhanglianxin/gists{/gist_id}","starred_url":"https://api.github.com/users/zhanglianxin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhanglianxin/subscriptions","organizations_url":"https://api.github.com/users/zhanglianxin/orgs","repos_url":"https://api.github.com/users/zhanglianxin/repos","events_url":"https://api.github.com/users/zhanglianxin/events{/privacy}","received_events_url":"https://api.github.com/users/zhanglianxin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-12T08:24:16Z","updated_at":"2017-05-12T08:24:16Z","closed_at":null,"body":"> Reference: https://docs.angularjs.org/tutorial/step_13\r\n\r\nThe RESTful functionality is provided by AngularJS in the ngResource module.\r\n\r\n```javascript\r\nthis.phones = Phone.query();\r\n```\r\n\r\nThis is a simple and declarative statement that we want to query for all phones.\r\n\r\nAn important thing to notice in the code above is that we don't pass any callback functions, when invoking methods of our `Phone` service. Although it looks as if the results were returned synchronously, that is not the case at all. What is returned synchronously is a \"future\" -- an object, which will be filled with data, when the XHR response is received. Because of the data-binding in AngularJS, we can use this future and bind it to our template. Then, when the data arrives, the view will be updated automatically.\r\n\r\nSometimes, relying on the future object and data-binding alone is not sufficient to do everything we require, so in these cases, we can add a callback to process the server response. The `phoneDetail` component's controller illustrates this by setting the `mainImageUrl` in a callback.\r\n"}}
{"actor":{"display_login":"zhanglianxin"}}