{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/12933","labels_url":"https://api.github.com/repos/angular/angular.js/issues/12933/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/12933/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/12933/events","html_url":"https://github.com/angular/angular.js/pull/12933","id":108073932,"number":12933,"title":"WIP - feat(loader): add convenience method for creating components","user":{"login":"shahata","id":1764161,"avatar_url":"https://avatars.githubusercontent.com/u/1764161?v=3","gravatar_id":"","url":"https://api.github.com/users/shahata","html_url":"https://github.com/shahata","followers_url":"https://api.github.com/users/shahata/followers","following_url":"https://api.github.com/users/shahata/following{/other_user}","gists_url":"https://api.github.com/users/shahata/gists{/gist_id}","starred_url":"https://api.github.com/users/shahata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shahata/subscriptions","organizations_url":"https://api.github.com/users/shahata/orgs","repos_url":"https://api.github.com/users/shahata/repos","events_url":"https://api.github.com/users/shahata/events{/privacy}","received_events_url":"https://api.github.com/users/shahata/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular.js/labels/frequency:%20high","name":"frequency: high","color":"f7c6c7"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20feature","name":"type: feature","color":"00a606"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/90","html_url":"https://github.com/angular/angular.js/milestones/1.5.x%20-%20migration-facilitation","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/90/labels","id":1025270,"number":90,"title":"1.5.x - migration-facilitation","description":"","creator":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"open_issues":77,"closed_issues":32,"state":"open","created_at":"2015-03-17T12:15:49Z","updated_at":"2015-10-06T12:54:47Z","due_on":null,"closed_at":null},"comments":27,"created_at":"2015-09-24T07:25:36Z","updated_at":"2015-10-07T21:23:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/angular/angular.js/pulls/12933","html_url":"https://github.com/angular/angular.js/pull/12933","diff_url":"https://github.com/angular/angular.js/pull/12933.diff","patch_url":"https://github.com/angular/angular.js/pull/12933.patch"},"body":"The proposed syntax:\r\n```js\r\nangular.module('myApp').component('myComponent', {\r\n  template: '<div></div>', //string | Function, default: ''\r\n  templateUrl: 'a.html', //string | Function, default: undefined\r\n  controller: MyCtrl, //string | Function, default: function(){}\r\n  controllerAs: 'vm', //string, default: component name\r\n  transclude: false, //boolean | object, default: true\r\n  isolate: false, //boolean, default: true (scope: {} .vs. scope: true)\r\n  bindings: {abc: '@'}, //object, default: {} (passed to bindToController)\r\n  $canActivate: MyCtrl.canActivate, //Function, default: undefined (passed to factory.$canActivate)\r\n  $routeConfig: MyCtrl.routeConfig, //RouteConfig, default: undefined (passed to factory.$routeConfig)\r\n});\r\n```\r\n\r\nThis means that for the most common use-case of simple component ppl will only need to pass template, controller and bindings.\r\n\r\nI've discussed this with @btford and we've decided to change a couple of things from #12907:\r\n 1. Controller lifecycle hooks (onActivate, onDeactivate, etc.) are not  going to be part of the component options since it makes more sense that the developer will just put those as methods of his controller (this way those methods have access to controller's state)\r\n 2. In case developer passes a function for template/templateUrl, this function is injectable with locals of $element and $attrs. This is important because today if you pass a function for template/templateUrl in DDO, you get element as attrs, but for DI you rely on the injectable DDO factory. In the component helper you don't have a factory, therefore we make all functions that can be passed in options injectable.\r\n\r\nDocs are still missing obviously, but I would like to get some feedback before moving on.\r\n\r\nCloses #10007 \r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/146334065","html_url":"https://github.com/angular/angular.js/pull/12933#issuecomment-146334065","issue_url":"https://api.github.com/repos/angular/angular.js/issues/12933","id":146334065,"user":{"login":"shahata","id":1764161,"avatar_url":"https://avatars.githubusercontent.com/u/1764161?v=3","gravatar_id":"","url":"https://api.github.com/users/shahata","html_url":"https://github.com/shahata","followers_url":"https://api.github.com/users/shahata/followers","following_url":"https://api.github.com/users/shahata/following{/other_user}","gists_url":"https://api.github.com/users/shahata/gists{/gist_id}","starred_url":"https://api.github.com/users/shahata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shahata/subscriptions","organizations_url":"https://api.github.com/users/shahata/orgs","repos_url":"https://api.github.com/users/shahata/repos","events_url":"https://api.github.com/users/shahata/events{/privacy}","received_events_url":"https://api.github.com/users/shahata/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T21:23:59Z","updated_at":"2015-10-07T21:23:59Z","body":"I've added first attempt of documenting this. Please review."}}