The digest cycle seems to be alive and well in Angular 2. Here's my
solution; hopefully I'm missing something and there is a more natural
reactive way to do this.
const domain$ = Rx.Observable.timer(0, 1000).startWith(0);
@Component({
selector: 'main-app',
template: `
<h1>Timer</h1>
<span>{{count|async}}</span><br/>
`
})
export class MainComponent {
constructor(ref: ChangeDetectorRef) {
this.count = domain$.map(i => `Seconds elapsed ${i}`);
domain$.subscribe(i => setTimeout(() => { ref.detectChanges() }));
}
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.