Created
July 24, 2019 18:30
-
-
Save vmasek/1735a45f21e257596fd5eff12bcce2c3 to your computer and use it in GitHub Desktop.
let directive multiple values example
This file contains hidden or 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
@Component({ | |
selector: 'app-root', | |
template: ` | |
<h1>mouse</h1> | |
<p | |
*viLet="{ | |
click: mouseClick$ | async, | |
move: mouseMove$ | async, | |
interval: interval$ | async, | |
} as mouse" | |
> | |
click [{{ mouse.click?.screenX }}, {{ mouse.click?.screenY }}] | |
<br /> | |
move [{{ mouse.move?.screenX }}, {{ mouse.move?.screenY }}] | |
<br /> | |
seconds from start {{ mouse.interval }} | |
<br /> | |
</p> | |
`, | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
}) | |
export class AppComponent { | |
readonly mouseClick$ = fromEvent(document, 'click') as Observable<MouseEvent>; | |
readonly mouseMove$: Observable<Event> = fromEvent(document, 'mousemove'); | |
readonly interval$ = interval(1000).pipe(startWith(0)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment