Here's the Angular component I'm working with:
export class UserListComponent implements OnInit, OnDestroy {
private _subscriptions: Subscription;
private _users: User[] = [];
private _clickableUser: boolean = true;
constructor(
private route: ActivatedRoute,
) { }
ngOnInit() {
const source = interval(1000);
const users = this.route.snapshot.data['users'] as IUserInterface[];
this._subscriptions = source.subscribe(() => this._users = users.map(user => new User(user)))
}
ngOnDestroy() {
this._subscriptions.unsubscribe();
}
I am able to retrieve the data, but the interval isn't updating it without a page refresh.