Skip to content

Commit

Permalink
rxjs --> toSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesHoppe committed Jan 29, 2025
1 parent 57bc09c commit 5c8b9ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h2>Counter {{ interval$ | async }}</h2>
<h2>Counter {{ interval() }}</h2>
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { AsyncPipe } from '@angular/common';
import { Component } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { tap, timer } from 'rxjs';

@Component({
templateUrl: './unsubscribe.component.html',
imports: [
AsyncPipe
]
})
export class UnsubscribeComponent {

interval$ = timer(0, 1000).pipe(
tap(console.log)
);
interval = toSignal(timer(0, 1000), { initialValue: 0 })
}

0 comments on commit 5c8b9ff

Please sign in to comment.