{"action":"created","issue":{"url":"https://api.github.com/repos/sprangular/sprangular/issues/85","labels_url":"https://api.github.com/repos/sprangular/sprangular/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/sprangular/sprangular/issues/85/comments","events_url":"https://api.github.com/repos/sprangular/sprangular/issues/85/events","html_url":"https://github.com/sprangular/sprangular/issues/85","id":58601610,"number":85,"title":"Store global data objects in service attributes to avoid fetching multiple times and share between controllers and other services","user":{"login":"simonwalsh","id":1783816,"avatar_url":"https://avatars.githubusercontent.com/u/1783816?v=3","gravatar_id":"","url":"https://api.github.com/users/simonwalsh","html_url":"https://github.com/simonwalsh","followers_url":"https://api.github.com/users/simonwalsh/followers","following_url":"https://api.github.com/users/simonwalsh/following{/other_user}","gists_url":"https://api.github.com/users/simonwalsh/gists{/gist_id}","starred_url":"https://api.github.com/users/simonwalsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonwalsh/subscriptions","organizations_url":"https://api.github.com/users/simonwalsh/orgs","repos_url":"https://api.github.com/users/simonwalsh/repos","events_url":"https://api.github.com/users/simonwalsh/events{/privacy}","received_events_url":"https://api.github.com/users/simonwalsh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-23T15:31:22Z","updated_at":"2015-02-23T22:53:56Z","closed_at":null,"body":"Noticed something that could be improved: when fetching data that is general to the whole site in a service api call, let's store it into an attribute of that service so... \r\n- that it is easily accessible in another service or a controller \r\n- that we don't have to do another api call to re-request the same data\r\n- that we don't have to depend on a parent controller for that data\r\n\r\nA good example of that could be https://github.com/sprangular/sprangular/blob/master/app/assets/javascripts/sprangular/services/catalog.coffee#L13-L16\r\n\r\nI will open up a PR and try to come up with a good pattern that we can then apply to other services.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sprangular/sprangular/issues/comments/75655790","html_url":"https://github.com/sprangular/sprangular/issues/85#issuecomment-75655790","issue_url":"https://api.github.com/repos/sprangular/sprangular/issues/85","id":75655790,"user":{"login":"simonwalsh","id":1783816,"avatar_url":"https://avatars.githubusercontent.com/u/1783816?v=3","gravatar_id":"","url":"https://api.github.com/users/simonwalsh","html_url":"https://github.com/simonwalsh","followers_url":"https://api.github.com/users/simonwalsh/followers","following_url":"https://api.github.com/users/simonwalsh/following{/other_user}","gists_url":"https://api.github.com/users/simonwalsh/gists{/gist_id}","starred_url":"https://api.github.com/users/simonwalsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonwalsh/subscriptions","organizations_url":"https://api.github.com/users/simonwalsh/orgs","repos_url":"https://api.github.com/users/simonwalsh/repos","events_url":"https://api.github.com/users/simonwalsh/events{/privacy}","received_events_url":"https://api.github.com/users/simonwalsh/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T22:53:56Z","updated_at":"2015-02-23T22:53:56Z","body":"Maybe we don't need that busting for things like taxonomies... \r\n\r\nBut I would still see this kind of flow be used for products for instance, which I think we could want them to be refreshed (with vigor!). Unless we use another strategy for that.\r\n\r\nAs for using interceptors/helpers, we should sit down together as I'm not sure how this is done. Or maybe you show me an example."}}