{"action":"closed","issue":{"url":"https://api.github.com/repos/angular/angular/issues/6317","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/6317/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/6317/comments","events_url":"https://api.github.com/repos/angular/angular/issues/6317/events","html_url":"https://github.com/angular/angular/issues/6317","id":125366514,"number":6317,"title":"Feature offer: some annotation inside templates to indicate the interface they require.","user":{"login":"matantsu","id":8289005,"avatar_url":"https://avatars.githubusercontent.com/u/8289005?v=3","gravatar_id":"","url":"https://api.github.com/users/matantsu","html_url":"https://github.com/matantsu","followers_url":"https://api.github.com/users/matantsu/followers","following_url":"https://api.github.com/users/matantsu/following{/other_user}","gists_url":"https://api.github.com/users/matantsu/gists{/gist_id}","starred_url":"https://api.github.com/users/matantsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matantsu/subscriptions","organizations_url":"https://api.github.com/users/matantsu/orgs","repos_url":"https://api.github.com/users/matantsu/repos","events_url":"https://api.github.com/users/matantsu/events{/privacy}","received_events_url":"https://api.github.com/users/matantsu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core%20&%20compiler","name":"comp: core & compiler","color":"c7def8"},{"url":"https://api.github.com/repos/angular/angular/labels/type:%20feature","name":"type: feature","color":"EEEEEE"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-01-07T10:26:33Z","updated_at":"2016-10-07T20:54:34Z","closed_at":"2016-10-07T20:54:34Z","body":"I think it will make templates much more self-contained if there was an annotation declaring what interface the template requires from it's component and have an alias for this component inside of the template.\r\n\r\nExample:\r\n```html\r\n<template-declaration>\r\n//define an interface this template requires.\r\ninterface IMyTemplate{\r\n   shoes: Shoe[],\r\n   currentUser: User\r\n}\r\n//get a reference to the component (must implement interface , otherwise compilation error)\r\nmyComponentAlias: IMyTemplate = component;\r\n</template-declaration>\r\n<div>\r\n    {{myComponentAlias.currentUser.name}}  // fine\r\n    {{myComponentAlias.unknownProperty}}  // compilation error\r\n</div>\r\n```\r\n\r\nThis would make a clear separation between layout&design vs view-logic. The designer would no longer need to refer to code and the coder would no longer need to refer to html to do their work. \r\n\r\nI could swap different components for the same view , as long as they implement the required interface.\r\n\r\nNow, I understand this is quite a demand and that it requires alot of work, templates now require compilation, have typescript inside of them etc...\r\nBut you wisards at angular are capable enough. Im sure @mhevery would like this feature."}}
{"actor":{"display_login":"vicb"}}