{"action":"created","issue":{"url":"https://api.github.com/repos/nervgh/angular-file-upload/issues/524","repository_url":"https://api.github.com/repos/nervgh/angular-file-upload","labels_url":"https://api.github.com/repos/nervgh/angular-file-upload/issues/524/labels{/name}","comments_url":"https://api.github.com/repos/nervgh/angular-file-upload/issues/524/comments","events_url":"https://api.github.com/repos/nervgh/angular-file-upload/issues/524/events","html_url":"https://github.com/nervgh/angular-file-upload/issues/524","id":107930497,"number":524,"title":"Inherit method seems to be invalid","user":{"login":"andreisumar","id":7620700,"avatar_url":"https://avatars.githubusercontent.com/u/7620700?v=3","gravatar_id":"","url":"https://api.github.com/users/andreisumar","html_url":"https://github.com/andreisumar","followers_url":"https://api.github.com/users/andreisumar/followers","following_url":"https://api.github.com/users/andreisumar/following{/other_user}","gists_url":"https://api.github.com/users/andreisumar/gists{/gist_id}","starred_url":"https://api.github.com/users/andreisumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreisumar/subscriptions","organizations_url":"https://api.github.com/users/andreisumar/orgs","repos_url":"https://api.github.com/users/andreisumar/repos","events_url":"https://api.github.com/users/andreisumar/events{/privacy}","received_events_url":"https://api.github.com/users/andreisumar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-09-23T14:19:56Z","updated_at":"2016-07-05T00:28:27Z","closed_at":null,"body":"I've encountered the need to set some of the options for FileUpload globally for all instances, for example Authorization header. Setting the header in each controller where FileUpload service is used would be too repetitive.\r\nI followed the official FAQ and decorated the service:\r\n```\r\n$provide.decorator('FileUploader', ['$delegate', 'authenticationInterceptor', function (FileUploader) {\r\n    FileUploader.inherit(AuthenticationAwareFileUploader, FileUploader);\r\n\r\n    function AuthenticationAwareFileUploader(options) {\r\n        angular.extend(options, {\r\n            headers: {\r\n                Authorization: getAuthorizationHeader()\r\n            }\r\n        });\r\n        AuthenticationAwareFileUploader.super_.apply(this, arguments);\r\n    }\r\n\r\n    return AuthenticationAwareFileUploader;\r\n}]);\r\n```\r\nAnd it's instantiating well, however, when I perform upload, a JS error is thrown to the console:\r\n`Uncaught TypeError: this.constructor.isArrayLikeObject is not a function`\r\n\r\nI've found out that the `inherit` method is not working properly as constructor does not have all the necessary properties, though I'm not familiar with the syntax of your sources to provide more qualified details.\r\n\r\nI was able to make it work properly my implementing the inheritance myself like that:\r\n```\r\nAuthenticationAwareFileUploader.prototype = FileUploader.prototype;\r\nAuthenticationAwareFileUploader.super_ = FileUploader;\r\n\r\nfunction AuthenticationAwareFileUploader(options) {\r\n    angular.extend(options, {\r\n        headers: {\r\n            Authorization: getAuthorizationHeader()\r\n        }\r\n    });\r\n    AuthenticationAwareFileUploader.super_.apply(this, arguments);\r\n}\r\n```\r\nAnd this change should probably be propagated to the implementation of `inherit` like that:\r\n```\r\n        static inherit(target, source) {\r\n            target.prototype = source.prototype;\r\n            target.super_ = source;\r\n        }\r\n```\r\n\r\nPlease let me know what you think about it.\r\n\r\nBut in general, I think it would be much better to expose some configuration methods in FileUploaderProvider so that we can set it up at config phase without tricky overrides / inheritance."},"comment":{"url":"https://api.github.com/repos/nervgh/angular-file-upload/issues/comments/230366419","html_url":"https://github.com/nervgh/angular-file-upload/issues/524#issuecomment-230366419","issue_url":"https://api.github.com/repos/nervgh/angular-file-upload/issues/524","id":230366419,"user":{"login":"pedrommuller","id":16243859,"avatar_url":"https://avatars.githubusercontent.com/u/16243859?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrommuller","html_url":"https://github.com/pedrommuller","followers_url":"https://api.github.com/users/pedrommuller/followers","following_url":"https://api.github.com/users/pedrommuller/following{/other_user}","gists_url":"https://api.github.com/users/pedrommuller/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrommuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrommuller/subscriptions","organizations_url":"https://api.github.com/users/pedrommuller/orgs","repos_url":"https://api.github.com/users/pedrommuller/repos","events_url":"https://api.github.com/users/pedrommuller/events{/privacy}","received_events_url":"https://api.github.com/users/pedrommuller/received_events","type":"User","site_admin":false},"created_at":"2016-07-05T00:28:27Z","updated_at":"2016-07-05T00:28:27Z","body":"+1"}}
{"actor":{"display_login":"pedrommuller"}}