{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular/pulls/comments/40974763","id":40974763,"diff_hunk":"@@ -1053,29 +1065,38 @@ export class HostBindingMetadata {\n }\n \n /**\n- * Declare a host listener.\n+ * Declares a host listener.\n  *\n- * ## Example\n+ * Angular will invoke the decorated method when the host element emits the specified event.\n  *\n- * ```\n- * @Directive({\n- *   selector: 'sample-dir'\n- * })\n- * class SampleDir {\n- *   @HostListener(\"change\", ['$event.target.value']) onChange(value){}\n- * }\n- * ```\n+ * If the decorated method returns `false`, then `preventDefault` is applied on the DOM\n+ * event.\n  *\n- * This is equivalent to\n+ * ### Example\n  *\n- * ```\n- * @Directive({\n- *   selector: 'sample-dir',\n- *   host: {'(change)': 'onChange($event.target.value)'}\n- * })\n- * class SampleDir {\n- *   onChange(value){}\n+ * The following example declares a directive that attaches a click listener to the button and\n+ * counts clicks.\n+ *\n+ * ```typescript\n+ * @Directive({selector: 'button[counting]'})\n+ * class CountClicks {\n+ *   numberOfClicks = 0;\n+ *\n+ *   @HostListener('click', ['$event.target'])\n+ *   onClick(targetButton) {\n+ *     console.log(\"button\", targetButton);","path":"modules/angular2/src/core/metadata/directives.ts","position":272,"original_position":272,"commit_id":"55d76e17894c9a87606978acffad134cad1e896c","original_commit_id":"55d76e17894c9a87606978acffad134cad1e896c","user":{"login":"jeffbcross","id":463703,"avatar_url":"https://avatars.githubusercontent.com/u/463703?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbcross","html_url":"https://github.com/jeffbcross","followers_url":"https://api.github.com/users/jeffbcross/followers","following_url":"https://api.github.com/users/jeffbcross/following{/other_user}","gists_url":"https://api.github.com/users/jeffbcross/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbcross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbcross/subscriptions","organizations_url":"https://api.github.com/users/jeffbcross/orgs","repos_url":"https://api.github.com/users/jeffbcross/repos","events_url":"https://api.github.com/users/jeffbcross/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbcross/received_events","type":"User","site_admin":false},"body":"Print the number of clicks!","created_at":"2015-10-01T22:35:48Z","updated_at":"2015-10-01T22:35:48Z","html_url":"https://github.com/angular/angular/pull/4451#discussion_r40974763","pull_request_url":"https://api.github.com/repos/angular/angular/pulls/4451","_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/comments/40974763"},"html":{"href":"https://github.com/angular/angular/pull/4451#discussion_r40974763"},"pull_request":{"href":"https://api.github.com/repos/angular/angular/pulls/4451"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/4451","id":46577415,"html_url":"https://github.com/angular/angular/pull/4451","diff_url":"https://github.com/angular/angular/pull/4451.diff","patch_url":"https://github.com/angular/angular/pull/4451.patch","issue_url":"https://api.github.com/repos/angular/angular/issues/4451","number":4451,"state":"open","locked":false,"title":"docs(core): add docs to HostBinding and HostListener","user":{"login":"vsavkin","id":35996,"avatar_url":"https://avatars.githubusercontent.com/u/35996?v=3","gravatar_id":"","url":"https://api.github.com/users/vsavkin","html_url":"https://github.com/vsavkin","followers_url":"https://api.github.com/users/vsavkin/followers","following_url":"https://api.github.com/users/vsavkin/following{/other_user}","gists_url":"https://api.github.com/users/vsavkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vsavkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsavkin/subscriptions","organizations_url":"https://api.github.com/users/vsavkin/orgs","repos_url":"https://api.github.com/users/vsavkin/repos","events_url":"https://api.github.com/users/vsavkin/events{/privacy}","received_events_url":"https://api.github.com/users/vsavkin/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-01T21:11:08Z","updated_at":"2015-10-01T22:35:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66a284d7d90ad5b6229f2dc6cf3d7afbb1c23e20","assignee":{"login":"jeffbcross","id":463703,"avatar_url":"https://avatars.githubusercontent.com/u/463703?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbcross","html_url":"https://github.com/jeffbcross","followers_url":"https://api.github.com/users/jeffbcross/followers","following_url":"https://api.github.com/users/jeffbcross/following{/other_user}","gists_url":"https://api.github.com/users/jeffbcross/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbcross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbcross/subscriptions","organizations_url":"https://api.github.com/users/jeffbcross/orgs","repos_url":"https://api.github.com/users/jeffbcross/repos","events_url":"https://api.github.com/users/jeffbcross/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbcross/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/angular/angular/pulls/4451/commits","review_comments_url":"https://api.github.com/repos/angular/angular/pulls/4451/comments","review_comment_url":"https://api.github.com/repos/angular/angular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular/issues/4451/comments","statuses_url":"https://api.github.com/repos/angular/angular/statuses/55d76e17894c9a87606978acffad134cad1e896c","head":{"label":"vsavkin:add_docs_to_host_binding_and_host_listener","ref":"add_docs_to_host_binding_and_host_listener","sha":"55d76e17894c9a87606978acffad134cad1e896c","user":{"login":"vsavkin","id":35996,"avatar_url":"https://avatars.githubusercontent.com/u/35996?v=3","gravatar_id":"","url":"https://api.github.com/users/vsavkin","html_url":"https://github.com/vsavkin","followers_url":"https://api.github.com/users/vsavkin/followers","following_url":"https://api.github.com/users/vsavkin/following{/other_user}","gists_url":"https://api.github.com/users/vsavkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vsavkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsavkin/subscriptions","organizations_url":"https://api.github.com/users/vsavkin/orgs","repos_url":"https://api.github.com/users/vsavkin/repos","events_url":"https://api.github.com/users/vsavkin/events{/privacy}","received_events_url":"https://api.github.com/users/vsavkin/received_events","type":"User","site_admin":false},"repo":{"id":24644769,"name":"angular","full_name":"vsavkin/angular","owner":{"login":"vsavkin","id":35996,"avatar_url":"https://avatars.githubusercontent.com/u/35996?v=3","gravatar_id":"","url":"https://api.github.com/users/vsavkin","html_url":"https://github.com/vsavkin","followers_url":"https://api.github.com/users/vsavkin/followers","following_url":"https://api.github.com/users/vsavkin/following{/other_user}","gists_url":"https://api.github.com/users/vsavkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vsavkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsavkin/subscriptions","organizations_url":"https://api.github.com/users/vsavkin/orgs","repos_url":"https://api.github.com/users/vsavkin/repos","events_url":"https://api.github.com/users/vsavkin/events{/privacy}","received_events_url":"https://api.github.com/users/vsavkin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vsavkin/angular","description":"","fork":true,"url":"https://api.github.com/repos/vsavkin/angular","forks_url":"https://api.github.com/repos/vsavkin/angular/forks","keys_url":"https://api.github.com/repos/vsavkin/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vsavkin/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vsavkin/angular/teams","hooks_url":"https://api.github.com/repos/vsavkin/angular/hooks","issue_events_url":"https://api.github.com/repos/vsavkin/angular/issues/events{/number}","events_url":"https://api.github.com/repos/vsavkin/angular/events","assignees_url":"https://api.github.com/repos/vsavkin/angular/assignees{/user}","branches_url":"https://api.github.com/repos/vsavkin/angular/branches{/branch}","tags_url":"https://api.github.com/repos/vsavkin/angular/tags","blobs_url":"https://api.github.com/repos/vsavkin/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vsavkin/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vsavkin/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/vsavkin/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vsavkin/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/vsavkin/angular/languages","stargazers_url":"https://api.github.com/repos/vsavkin/angular/stargazers","contributors_url":"https://api.github.com/repos/vsavkin/angular/contributors","subscribers_url":"https://api.github.com/repos/vsavkin/angular/subscribers","subscription_url":"https://api.github.com/repos/vsavkin/angular/subscription","commits_url":"https://api.github.com/repos/vsavkin/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/vsavkin/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/vsavkin/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/vsavkin/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/vsavkin/angular/contents/{+path}","compare_url":"https://api.github.com/repos/vsavkin/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vsavkin/angular/merges","archive_url":"https://api.github.com/repos/vsavkin/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vsavkin/angular/downloads","issues_url":"https://api.github.com/repos/vsavkin/angular/issues{/number}","pulls_url":"https://api.github.com/repos/vsavkin/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/vsavkin/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/vsavkin/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vsavkin/angular/labels{/name}","releases_url":"https://api.github.com/repos/vsavkin/angular/releases{/id}","created_at":"2014-09-30T15:59:47Z","updated_at":"2015-06-09T11:17:07Z","pushed_at":"2015-10-01T21:11:01Z","git_url":"git://github.com/vsavkin/angular.git","ssh_url":"git@github.com:vsavkin/angular.git","clone_url":"https://github.com/vsavkin/angular.git","svn_url":"https://github.com/vsavkin/angular","homepage":null,"size":18023,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"a87ebb28e243b87ec74d2c6541ec5094a3273ab4","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":24195339,"name":"angular","full_name":"angular/angular","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/angular","description":"","fork":false,"url":"https://api.github.com/repos/angular/angular","forks_url":"https://api.github.com/repos/angular/angular/forks","keys_url":"https://api.github.com/repos/angular/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular/teams","hooks_url":"https://api.github.com/repos/angular/angular/hooks","issue_events_url":"https://api.github.com/repos/angular/angular/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular/events","assignees_url":"https://api.github.com/repos/angular/angular/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular/tags","blobs_url":"https://api.github.com/repos/angular/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular/languages","stargazers_url":"https://api.github.com/repos/angular/angular/stargazers","contributors_url":"https://api.github.com/repos/angular/angular/contributors","subscribers_url":"https://api.github.com/repos/angular/angular/subscribers","subscription_url":"https://api.github.com/repos/angular/angular/subscription","commits_url":"https://api.github.com/repos/angular/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular/merges","archive_url":"https://api.github.com/repos/angular/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular/downloads","issues_url":"https://api.github.com/repos/angular/angular/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular/releases{/id}","created_at":"2014-09-18T16:12:01Z","updated_at":"2015-10-01T22:13:45Z","pushed_at":"2015-10-01T22:24:57Z","git_url":"git://github.com/angular/angular.git","ssh_url":"git@github.com:angular/angular.git","clone_url":"https://github.com/angular/angular.git","svn_url":"https://github.com/angular/angular","homepage":"https://angular.io","size":55912,"stargazers_count":5586,"watchers_count":5586,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1527,"mirror_url":null,"open_issues_count":490,"forks":1527,"open_issues":490,"watchers":5586,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/4451"},"html":{"href":"https://github.com/angular/angular/pull/4451"},"issue":{"href":"https://api.github.com/repos/angular/angular/issues/4451"},"comments":{"href":"https://api.github.com/repos/angular/angular/issues/4451/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular/pulls/4451/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular/pulls/4451/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular/statuses/55d76e17894c9a87606978acffad134cad1e896c"}}}}