-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 🐛 type check on component outputs (#693)
Allow subjects as component output ✅ Closes: #689
- Loading branch information
Showing
4 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 15 additions & 2 deletions
17
projects/spectator/test/function-output/function-output.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import { Component, input, output, ɵINPUT_SIGNAL_BRAND_WRITE_TYPE } from '@angular/core'; | ||
import { Component, EventEmitter, input, Output, output, ɵINPUT_SIGNAL_BRAND_WRITE_TYPE } from '@angular/core'; | ||
import { ReplaySubject } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'app-function-output', | ||
template: ` <button (click)="buttonClick.emit(true)">Emit function output</button> `, | ||
template: ` <button (click)="buttonClicked()">Emit function output</button> `, | ||
standalone: true, | ||
}) | ||
export class FunctionOutputComponent { | ||
public buttonClick = output<boolean>(); | ||
|
||
@Output() | ||
public buttonClickedEvent = new EventEmitter<boolean>(); | ||
|
||
@Output() | ||
public buttonClickedSubject = new ReplaySubject<boolean>(); | ||
|
||
protected buttonClicked(): void { | ||
this.buttonClick.emit(true); | ||
this.buttonClickedEvent.emit(true); | ||
this.buttonClickedSubject.next(true); | ||
} | ||
} |