Created
August 15, 2023 13:02
-
-
Save rainerhahnekamp/d102905308c2d374d7b757f1ab26a3e9 to your computer and use it in GitHub Desktop.
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
// Example showing property binding for ngComponentOutle | |
@Component({ | |
template: `<ng-container | |
*ngComponentOutlet="component; inputs: context" | |
></ng-container>`, | |
standalone: true, | |
imports: [NgComponentOutlet], | |
}) | |
export class AppComponent { | |
daylightService = inject(DaylightService); | |
component = this.daylightService.isDay() | |
? WelcomeAtDayComponent | |
: WelcomeAtNightComponent; | |
context: Record<string, unknown> = {}; | |
constructor() { | |
const { sunrise, sunset } = this.daylightService.getSunTimes(); | |
this.context = { | |
username: inject(UserService).username, | |
sunrise, sunset, | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment