{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/10646","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/10646/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/10646/comments","events_url":"https://api.github.com/repos/angular/angular/issues/10646/events","html_url":"https://github.com/angular/angular/issues/10646","id":170471322,"number":10646,"title":"Using multiple components in different modules causing \"Type X is part of the declarations of 2 modules\" error","user":{"login":"pleerock","id":1753397,"avatar_url":"https://avatars.githubusercontent.com/u/1753397?v=3","gravatar_id":"","url":"https://api.github.com/users/pleerock","html_url":"https://github.com/pleerock","followers_url":"https://api.github.com/users/pleerock/followers","following_url":"https://api.github.com/users/pleerock/following{/other_user}","gists_url":"https://api.github.com/users/pleerock/gists{/gist_id}","starred_url":"https://api.github.com/users/pleerock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pleerock/subscriptions","organizations_url":"https://api.github.com/users/pleerock/orgs","repos_url":"https://api.github.com/users/pleerock/repos","events_url":"https://api.github.com/users/pleerock/events{/privacy}","received_events_url":"https://api.github.com/users/pleerock/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":33,"created_at":"2016-08-10T17:19:33Z","updated_at":"2016-12-12T20:31:21Z","closed_at":"2016-08-12T05:46:18Z","body":"**I'm submitting a ...**  (check one with \"x\")\n\n```\n[ ] bug report\n[x] feature request\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\n```\n\n**Current behavior**\n\nRight now you cannot import two directives of the same module \n\n**Expected/desired behavior**\n\nYou can use same directives/components in multiple modules without errors.\n\n**What is the motivation / use case for changing the behavior?**\n\nConcept of the shared module with its shared resources is good for components that are used everywhere. But if you have a complex application (ours contain more then 50 modules and 1500 components, services and pipes all together) multiple components can be reused different way. For example QuestionListPage uses UserActiveListPanel from User module. Also PhotoListPage uses same UserActiveListPanel, and VideoListPage uses UserActiveListPanel. How do I reuse this panel? Best way is see is to provide it in `directives` of the component as it was before rc.5. But right now I can't do it. But I can create lets say UserShareModule and put it there... its good, but if I put everything that is used by other modules from user module, i'll LOT of things there unnecessary in most of times. Then what to do? Create UserActiveListPanelShareModule? It will create lot of such trash files. So what to do? Maybe we simply can provide same directives multiple times without having this annoying error `Type X is part of the declarations of 2 modules`?\n\nIf you tell me that its by design, then my answer is: in my opinion its a bad design.\n\n**Please tell us about your environment:**\n- **Angular version:** 2.0.0-rc.5\n- **Browser:** [all ] \n- **Language:** [all] \n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/266544013","html_url":"https://github.com/angular/angular/issues/10646#issuecomment-266544013","issue_url":"https://api.github.com/repos/angular/angular/issues/10646","id":266544013,"user":{"login":"linusbrolin","id":3481784,"avatar_url":"https://avatars.githubusercontent.com/u/3481784?v=3","gravatar_id":"","url":"https://api.github.com/users/linusbrolin","html_url":"https://github.com/linusbrolin","followers_url":"https://api.github.com/users/linusbrolin/followers","following_url":"https://api.github.com/users/linusbrolin/following{/other_user}","gists_url":"https://api.github.com/users/linusbrolin/gists{/gist_id}","starred_url":"https://api.github.com/users/linusbrolin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linusbrolin/subscriptions","organizations_url":"https://api.github.com/users/linusbrolin/orgs","repos_url":"https://api.github.com/users/linusbrolin/repos","events_url":"https://api.github.com/users/linusbrolin/events{/privacy}","received_events_url":"https://api.github.com/users/linusbrolin/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T20:31:21Z","updated_at":"2016-12-12T20:31:21Z","body":"What if I have dozens of single-purpose components, that can be included by any number of other components (forms, subforms, views, etc)?\r\nFor example:\r\nConsider an orderform, consisting of one component that has the customer information, one component that has a FormArray for each orderitem and then one component for each orderitem.\r\nAnd for when the orderform is locked, I have the same amount of components for presenting just a view (cannot be changed by the user).\r\n\r\nDo I have to create an NgModule for each and every one of those components?\r\n\r\nIf I create just one NgModule for all the orderitem related components, it means that loading a view component will also load FormModule/ReactiveFormModule for example..\r\nThat's completely unneccesary.\r\n\r\nIf I create a single NgModule for all of it, it will be quite bloated and that will result in longer load times, which is also bad. (I'm using http/2, so bundling into one single huge file is a bad thing for me).\r\n\r\nSo currently I see no other way than to make one NgModule for each and every single component/subcomponent/modal/etc file in the application (in order to not affect load times), which will force me to make hundreds of them. :/"}}
{"actor":{"display_login":"linusbrolin"}}