Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular: Create actions for Outputs by default #14299

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Object {
},
},
"onClick": Object {
"action": "onClick",
"defaultValue": undefined,
"description": "<p>Handler to be called when the button is clicked by a user.</p>
<p>Will also block the emission of the event if <code>isDisabled</code> is true.</p>
Expand Down
2 changes: 2 additions & 0 deletions addons/docs/src/frameworks/angular/compodoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,13 @@ export const extractArgTypesFromData = (componentData: Class | Directive | Injec
isMethod(item) || section !== 'inputs'
? { name: 'void' }
: extractType(item as Property, defaultValue);
const action = section === 'outputs' ? { action: item.name } : {};
const argType = {
name: item.name,
description: item.description,
defaultValue,
type,
...action,
table: {
category: section,
type: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ export class DocButtonComponent<T> {
return this._inputValue;
}

@HostListener('click', ['$event.target'])
onClickListener(btn) {
console.log('button', btn);
@HostListener('click', ['$event'])
onClickListener(event) {
console.log('button', event.target);
this.handleClick(event);
}

@HostBinding('class.focused') focus = false;
Expand Down