{"action":"created","issue":{"url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/issues/4","labels_url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/issues/4/comments","events_url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/issues/4/events","html_url":"https://github.com/mchlbrnd/swagged-angular-resources/issues/4","id":107232773,"number":4,"title":"Use generated providers to configure $resource and/or its actions","user":{"login":"mchlbrnd","id":2854221,"avatar_url":"https://avatars.githubusercontent.com/u/2854221?v=3","gravatar_id":"","url":"https://api.github.com/users/mchlbrnd","html_url":"https://github.com/mchlbrnd","followers_url":"https://api.github.com/users/mchlbrnd/followers","following_url":"https://api.github.com/users/mchlbrnd/following{/other_user}","gists_url":"https://api.github.com/users/mchlbrnd/gists{/gist_id}","starred_url":"https://api.github.com/users/mchlbrnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchlbrnd/subscriptions","organizations_url":"https://api.github.com/users/mchlbrnd/orgs","repos_url":"https://api.github.com/users/mchlbrnd/repos","events_url":"https://api.github.com/users/mchlbrnd/events{/privacy}","received_events_url":"https://api.github.com/users/mchlbrnd/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"mchlbrnd","id":2854221,"avatar_url":"https://avatars.githubusercontent.com/u/2854221?v=3","gravatar_id":"","url":"https://api.github.com/users/mchlbrnd","html_url":"https://github.com/mchlbrnd","followers_url":"https://api.github.com/users/mchlbrnd/followers","following_url":"https://api.github.com/users/mchlbrnd/following{/other_user}","gists_url":"https://api.github.com/users/mchlbrnd/gists{/gist_id}","starred_url":"https://api.github.com/users/mchlbrnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchlbrnd/subscriptions","organizations_url":"https://api.github.com/users/mchlbrnd/orgs","repos_url":"https://api.github.com/users/mchlbrnd/repos","events_url":"https://api.github.com/users/mchlbrnd/events{/privacy}","received_events_url":"https://api.github.com/users/mchlbrnd/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-09-18T16:17:02Z","updated_at":"2015-09-20T14:27:17Z","closed_at":null,"body":"Currently, the $resourceConfigProvider can be injected into a module's config block to configure generated resources and/or its actions like so;\r\n\r\n1. Config for all generated resources:\r\n$resourceActionConfigProvider.addActionConfig({timeout: 5000});\r\n\r\n2. Config for a generated resource;\r\n$resourceActionConfigProvider.addActionConfig('MyResource', {timeout: 5000});\r\n\r\n3. Config for a generated resource's action:\r\n$resourceActionConfigProvider.addActionConfig('MyResource', 'MyAction', {timeout: 5000});\r\n\r\nIn the coming major (0.1.0) release, I'm planning to refactor this method onto the generated resources. Since these are generated as providers, it makes a lot of sense to inject these into config blocks. The string parameters are error prone and mess up syntax highlighting/completion in some IDEs. This change would make us write;\r\n\r\n1. Config all generated resources should still be an additional provider, an object constant  or a decorator of $resourceProvider. Perhaps global configuration should happen explicitly on all generated resource providers in the config block.\r\n\r\n2. Config a generated resource;\r\nMyResourceProvider.config({timeout: 5000});\r\n\r\n3. Config a specific resource's action:\r\nMyResourceProvider.MyAction.config( {timeout: 5000});\r\n\r\nChaining should be possible for 2 and 3. MyResourceProvider.config(...).config(...).MyAction.config(...).\r\n\r\nAdditionally, I propose configuration of the generated resource outside the config block for use in very specific scenarios.\r\n\r\n1.Config a generated resource;\r\nvar myResource = MyResource({timeout: 5000});\r\nmyResource.$MyAction(...);\r\n\r\n2. Config a generated resource's action:\r\nvar myResource = MyResource({timeout: 10000}).MyAction( {timeout: 5000})(...);\r\n\r\nIn the latter case, MyAction's config would override MyResource's config. To support this we need to implement  function wrappers.\r\n\r\nWith this change the generated resources are configurable in and outside the config block.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/issues/comments/141792379","html_url":"https://github.com/mchlbrnd/swagged-angular-resources/issues/4#issuecomment-141792379","issue_url":"https://api.github.com/repos/mchlbrnd/swagged-angular-resources/issues/4","id":141792379,"user":{"login":"mchlbrnd","id":2854221,"avatar_url":"https://avatars.githubusercontent.com/u/2854221?v=3","gravatar_id":"","url":"https://api.github.com/users/mchlbrnd","html_url":"https://github.com/mchlbrnd","followers_url":"https://api.github.com/users/mchlbrnd/followers","following_url":"https://api.github.com/users/mchlbrnd/following{/other_user}","gists_url":"https://api.github.com/users/mchlbrnd/gists{/gist_id}","starred_url":"https://api.github.com/users/mchlbrnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchlbrnd/subscriptions","organizations_url":"https://api.github.com/users/mchlbrnd/orgs","repos_url":"https://api.github.com/users/mchlbrnd/repos","events_url":"https://api.github.com/users/mchlbrnd/events{/privacy}","received_events_url":"https://api.github.com/users/mchlbrnd/received_events","type":"User","site_admin":false},"created_at":"2015-09-20T14:27:17Z","updated_at":"2015-09-20T14:27:17Z","body":"Work in progress is here https://github.com/mchlbrnd/swagged-angular-resources/tree/resource-provider-config"}}