{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/templating/issues/171","repository_url":"https://api.github.com/repos/aurelia/templating","labels_url":"https://api.github.com/repos/aurelia/templating/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/templating/issues/171/comments","events_url":"https://api.github.com/repos/aurelia/templating/issues/171/events","html_url":"https://github.com/aurelia/templating/issues/171","id":105932248,"number":171,"title":"customElement as \"templateController\"","user":{"login":"Alxandr","id":112334,"avatar_url":"https://avatars.githubusercontent.com/u/112334?v=3","gravatar_id":"","url":"https://api.github.com/users/Alxandr","html_url":"https://github.com/Alxandr","followers_url":"https://api.github.com/users/Alxandr/followers","following_url":"https://api.github.com/users/Alxandr/following{/other_user}","gists_url":"https://api.github.com/users/Alxandr/gists{/gist_id}","starred_url":"https://api.github.com/users/Alxandr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alxandr/subscriptions","organizations_url":"https://api.github.com/users/Alxandr/orgs","repos_url":"https://api.github.com/users/Alxandr/repos","events_url":"https://api.github.com/users/Alxandr/events{/privacy}","received_events_url":"https://api.github.com/users/Alxandr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/templating/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"EisenbergEffect","id":131485,"avatar_url":"https://avatars.githubusercontent.com/u/131485?v=3","gravatar_id":"","url":"https://api.github.com/users/EisenbergEffect","html_url":"https://github.com/EisenbergEffect","followers_url":"https://api.github.com/users/EisenbergEffect/followers","following_url":"https://api.github.com/users/EisenbergEffect/following{/other_user}","gists_url":"https://api.github.com/users/EisenbergEffect/gists{/gist_id}","starred_url":"https://api.github.com/users/EisenbergEffect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EisenbergEffect/subscriptions","organizations_url":"https://api.github.com/users/EisenbergEffect/orgs","repos_url":"https://api.github.com/users/EisenbergEffect/repos","events_url":"https://api.github.com/users/EisenbergEffect/events{/privacy}","received_events_url":"https://api.github.com/users/EisenbergEffect/received_events","type":"User","site_admin":false},"assignees":[{"login":"EisenbergEffect","id":131485,"avatar_url":"https://avatars.githubusercontent.com/u/131485?v=3","gravatar_id":"","url":"https://api.github.com/users/EisenbergEffect","html_url":"https://github.com/EisenbergEffect","followers_url":"https://api.github.com/users/EisenbergEffect/followers","following_url":"https://api.github.com/users/EisenbergEffect/following{/other_user}","gists_url":"https://api.github.com/users/EisenbergEffect/gists{/gist_id}","starred_url":"https://api.github.com/users/EisenbergEffect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EisenbergEffect/subscriptions","organizations_url":"https://api.github.com/users/EisenbergEffect/orgs","repos_url":"https://api.github.com/users/EisenbergEffect/repos","events_url":"https://api.github.com/users/EisenbergEffect/events{/privacy}","received_events_url":"https://api.github.com/users/EisenbergEffect/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2015-09-11T02:17:25Z","updated_at":"2016-07-04T19:05:36Z","closed_at":null,"body":"Custom elements should be able to be \"template controllers\". What I mean is the following:\r\n\r\nCurrently, to create a custom element that uses it's light DOM (child nodes) as a view/view factory, you have to jump through quite a few hoops. First, you need to add `@processContent(false)`, then, you need to inject `ViewResources, ViewSlot, ViewCompiler, Container, Element`, and lastly, in the constructor you need to do this whole circus:\r\n\r\n```js\r\nconst fragment = document.createDocumentFragment();\r\n\r\nlet child;\r\n\r\nwhile ((child = element.firstElementChild) !== null) {\r\n  fragment.appendChild(child);\r\n}\r\n\r\nthis.viewFactory = viewCompiler.compile(fragment, viewResources);\r\nthis.container = container;\r\nthis.viewSlot = viewSlot;\r\n```\r\n\r\nIf this was a `templateController`, I'd be able to simply inject a `BoundViewFactory` and the `ViewSlot` and call it a day. My point is, I don't really care about the view resources, the container being used, or even the element in question. I just need all those things to go through a bunch of formalities to get the same sort of functionality that you can get for free on custom attributes, and I have to do it for every custom element I create that wants this kind of functionality."},"comment":{"url":"https://api.github.com/repos/aurelia/templating/issues/comments/230342808","html_url":"https://github.com/aurelia/templating/issues/171#issuecomment-230342808","issue_url":"https://api.github.com/repos/aurelia/templating/issues/171","id":230342808,"user":{"login":"jods4","id":3832820,"avatar_url":"https://avatars.githubusercontent.com/u/3832820?v=3","gravatar_id":"","url":"https://api.github.com/users/jods4","html_url":"https://github.com/jods4","followers_url":"https://api.github.com/users/jods4/followers","following_url":"https://api.github.com/users/jods4/following{/other_user}","gists_url":"https://api.github.com/users/jods4/gists{/gist_id}","starred_url":"https://api.github.com/users/jods4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jods4/subscriptions","organizations_url":"https://api.github.com/users/jods4/orgs","repos_url":"https://api.github.com/users/jods4/repos","events_url":"https://api.github.com/users/jods4/events{/privacy}","received_events_url":"https://api.github.com/users/jods4/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T19:05:36Z","updated_at":"2016-07-04T19:05:36Z","body":"+1 for this.\r\nAlso today when applying `@templateController` to a custom element (naively or by confusion) the browser crash with a stack overflow (infinite recursion). This is _very_ unfriendly for the dev and you can loose a lot of time if you don't realise/know what causes this loop..."}}
{"actor":{"display_login":"jods4"}}