{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/12920","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/12920/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/12920/comments","events_url":"https://api.github.com/repos/angular/angular/issues/12920/events","html_url":"https://github.com/angular/angular/issues/12920","id":189765588,"number":12920,"title":"Can not inherit from RoutlerOutlet (or from any directive ?)","user":{"login":"fredgate","id":3648269,"avatar_url":"https://avatars.githubusercontent.com/u/3648269?v=3","gravatar_id":"","url":"https://api.github.com/users/fredgate","html_url":"https://github.com/fredgate","followers_url":"https://api.github.com/users/fredgate/followers","following_url":"https://api.github.com/users/fredgate/following{/other_user}","gists_url":"https://api.github.com/users/fredgate/gists{/gist_id}","starred_url":"https://api.github.com/users/fredgate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fredgate/subscriptions","organizations_url":"https://api.github.com/users/fredgate/orgs","repos_url":"https://api.github.com/users/fredgate/repos","events_url":"https://api.github.com/users/fredgate/events{/privacy}","received_events_url":"https://api.github.com/users/fredgate/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-16T16:44:10Z","updated_at":"2016-11-17T18:01:38Z","closed_at":"2016-11-16T17:23:13Z","body":"**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[x] bug report => search github for a similar issue or PR before submitting\r\n[ ] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nI want to create a custom RouterOutlet.\r\nFor that I create a new directive that inherit from RouterOutlet and define a new selector.\r\n```\r\n@Directive({\r\n\tselector: 'custom-router-outlet',\r\n\texportAs: 'customRouterOutlet'\r\n})\r\nexport class CustomRouterOutlet extends RouterOutlet {\r\n\tconstructor(\r\n\t\tparentOutletMap: RouterOutletMap,\r\n\t\tlocation: ViewContainerRef,\r\n\t\tresolver: ComponentFactoryResolver,\r\n\t\t@Attribute('name') name: string) {\r\n\t\tsuper(parentOutletMap, location, resolver, name);\r\n\t\tconsole.info(\"custom router outlet !!\");\r\n\t}\r\n}\r\n```\r\nThen I import this directive in my app module, and use it in the template of my app component :\r\n```\r\n <custom-router-outlet></custom-router-outlet>\r\n```\r\nThe application fail to load because an error occurs :\r\n\r\n> Unhandled Promise rejection: Template parse errors:\r\n> 'custom-router-outlet' is not a known element:\r\n> 1. If 'custom-router-outlet' is an Angular component, then verify that it is part of this module.\r\n> 2. If 'custom-router-outlet' is a Web Component then add \"CUSTOM_ELEMENTS_SCHEMA\" to the '@NgModule.schemas' of this component to suppress this message.\r\n\r\nIf I change the selector of my CustomRouterOutlet to set the same as RouterOutlet, and use <router-outlet> in my template, then the application load succesfully and my custom RouterOutlet is well used (message in the constructor appears in the console).\r\nBut if I add a template variable #outlet, then the application fails again with a message indicating that there is no directive with the exportAs _CustomRouterOulet_.\r\nIt seems that angular use the Directive annotation of the parent directive, and not that of the child directive.\r\n\r\nI have the problem with the RouterOutlet directive but may be that the problem is more global and that it occurs with all inherited directives.\r\n\r\n**Expected behavior**\r\nThe application should work and display the components in the custom router outlet.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\nHere is a plunker showing the problem :\r\n  http://plnkr.co/edit/mNJeZE2GAIaYWkkyn9cn?p=preview\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nBe able to use a custom router outlet.\r\n\r\n**Please tell us about your environment:**\r\n* **Angular version:**\r\n2.1.1\r\n**I had not the problem before when I used Angular 2 beta 17** (sorry I did not use intermediate versions like rc), so it seems a severe regression.\r\n\r\n* **Browser:**\r\nTested with Firefox and Internet Explorer, but surely on all browsers.\r\n \r\n* **Language:**\r\nTested with typescript.\r\n\r\n* **Node (for AoT issues):** `node --version` =   \r\nAoT not used."},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/261320966","html_url":"https://github.com/angular/angular/issues/12920#issuecomment-261320966","issue_url":"https://api.github.com/repos/angular/angular/issues/12920","id":261320966,"user":{"login":"zoechi","id":405837,"avatar_url":"https://avatars.githubusercontent.com/u/405837?v=3","gravatar_id":"","url":"https://api.github.com/users/zoechi","html_url":"https://github.com/zoechi","followers_url":"https://api.github.com/users/zoechi/followers","following_url":"https://api.github.com/users/zoechi/following{/other_user}","gists_url":"https://api.github.com/users/zoechi/gists{/gist_id}","starred_url":"https://api.github.com/users/zoechi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoechi/subscriptions","organizations_url":"https://api.github.com/users/zoechi/orgs","repos_url":"https://api.github.com/users/zoechi/repos","events_url":"https://api.github.com/users/zoechi/events{/privacy}","received_events_url":"https://api.github.com/users/zoechi/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T18:01:38Z","updated_at":"2016-11-17T18:01:38Z","body":"#11606 is an issue about all issues related to inheritance. If the component is not recognized because it inherits another component, then it will be addressed by #11606"}}
{"actor":{"display_login":"zoechi"}}