{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/1451","labels_url":"https://api.github.com/repos/angular/angular/issues/1451/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/1451/comments","events_url":"https://api.github.com/repos/angular/angular/issues/1451/events","html_url":"https://github.com/angular/angular/issues/1451","id":69455671,"number":1451,"title":"Integrating More Convention over Configuration in Angular 2","user":{"login":"DanWahlin","id":1767249,"avatar_url":"https://avatars.githubusercontent.com/u/1767249?v=3","gravatar_id":"","url":"https://api.github.com/users/DanWahlin","html_url":"https://github.com/DanWahlin","followers_url":"https://api.github.com/users/DanWahlin/followers","following_url":"https://api.github.com/users/DanWahlin/following{/other_user}","gists_url":"https://api.github.com/users/DanWahlin/gists{/gist_id}","starred_url":"https://api.github.com/users/DanWahlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanWahlin/subscriptions","organizations_url":"https://api.github.com/users/DanWahlin/orgs","repos_url":"https://api.github.com/users/DanWahlin/repos","events_url":"https://api.github.com/users/DanWahlin/events{/privacy}","received_events_url":"https://api.github.com/users/DanWahlin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-19T19:25:08Z","updated_at":"2015-04-20T14:45:21Z","closed_at":null,"body":"Is any consideration being given to integrating more default conventions into Angular 2? This may be something that is already in there and I just haven't seen it or something already planned, but I wanted to  explore it. Here's what I mean by \"default conventions\". \r\n\r\nA typical component looks like this:\r\n\r\n```javascript\r\nimport {\r\n  bootstrap,\r\n  Component,\r\n  View\r\n} from 'angular2/angular2'\r\n\r\n@Component({\r\n  selector: 'MyComponent'\r\n})\r\n@View({\r\n  templateUrl: 'my-component.html'\r\n})\r\nclass MyComponent {\r\n  constructor() {\r\n    this.name = 'My Component';\r\n  }\r\n}\r\n```\r\n\r\nBy adding some smart default conventions it could look like this:\r\n\r\n```javascript\r\nimport {\r\n  bootstrap,\r\n  Component,\r\n  View\r\n} from 'angular2/angular2'\r\n\r\n@Component()\r\nclass MyComponent {\r\n  constructor() {\r\n    this.name = 'My Component';\r\n  }\r\n}\r\n```\r\n\r\nHere's what default conventions would buy us:\r\n\r\n1. The component selector defaults to **my-component** (much like directives do today in Angular 1.x).\r\n2. The view defaults to a URL of **my-component.html** (with a default view location that would have to be determined). No need to add @View in this situation but in cases where the templateUrl is different or it's an inline template then @View can be added.\r\n\r\nI realize this doesn't cover component injectables, view directives (still not a fan of having to define those here), and other properties that may be needed, but there may be a way to add some convention there as well.\r\n\r\nI'm sure there are several other cases where conventions could potentially be used. By adding some smart default conventions some of the boilerplate code could be eliminated while still allowing people to override the defaults by supplying the proper annotations as needed. That would be great for people moving to the framework (code would appear much less intimidating at first glance since many aren't used to annotations) and also great for devs since less code would have to be written in some cases.\r\n\r\nThere might even be a simplified convention for importing the default modules used in this case. For example, a \"standard\" component that needs bootstrap, Component, and View might just be wrapped up like this:\r\n\r\n```javascript\r\nimport {ComponentDefault} from 'angular2/angular2'\r\n\r\n@Component()\r\nclass MyComponent {\r\n  constructor() {\r\n    this.name = 'My Component';\r\n  }\r\n}\r\n```\r\n\r\nIf some of the convention suggestions are already in there (or being planned) let me know. For me personally, it just feels like way too much boilerplate code to something relatively simple. Some default conventions would clean that up.\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/94471880","html_url":"https://github.com/angular/angular/issues/1451#issuecomment-94471880","issue_url":"https://api.github.com/repos/angular/angular/issues/1451","id":94471880,"user":{"login":"DanWahlin","id":1767249,"avatar_url":"https://avatars.githubusercontent.com/u/1767249?v=3","gravatar_id":"","url":"https://api.github.com/users/DanWahlin","html_url":"https://github.com/DanWahlin","followers_url":"https://api.github.com/users/DanWahlin/followers","following_url":"https://api.github.com/users/DanWahlin/following{/other_user}","gists_url":"https://api.github.com/users/DanWahlin/gists{/gist_id}","starred_url":"https://api.github.com/users/DanWahlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanWahlin/subscriptions","organizations_url":"https://api.github.com/users/DanWahlin/orgs","repos_url":"https://api.github.com/users/DanWahlin/repos","events_url":"https://api.github.com/users/DanWahlin/events{/privacy}","received_events_url":"https://api.github.com/users/DanWahlin/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T14:45:21Z","updated_at":"2015-04-20T14:45:21Z","body":"Thanks for the info on the related issues @pkozlowski-opensource. Sounds like we're all on the same track here. Hopefully some of this can be cleaned up to reduce the boilerplate code more."}}