Cannot use Observable.interval(x) in startup of Angular2 SPA #1261

Closed
opened 2025-08-09 17:19:28 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @deadwards90 on 11/16/2016

When using the Angular2 SPA, I stripped down the application so there was nothing but complete bare bones. Just the home and app component, removed the nav bar etc.

I then added the following:

import { Component } from '@angular/core';
import {Observable } from 'rxjs/Rx';

@Component({
    selector: 'home', 
    templateUrl: './home.component.html',
})
export class HomeComponent {
    oJobs = Observable.interval(300);
    constructor() {
    }
}

With the a template:

<h1>Hello, world!</h1>
<ul>
    <span>{{oJobs | async}}</span>
</ul>

Every time I run this, I get the following error:

Exception: Call to Node module failed with error: Prerendering timed out after 30000ms because the boot function in 'ClientApp/dist/main-server' returned a promise that did not resolve or reject. Make sure that your boot function always resolves or rejects its promise. You can change the timeout value using the 'asp-prerender-timeout' tag helper.

Also it weirdly works OK if you were to comment out the binding on the HTML, run the application, then put it back in. When the refresh happens, the numbers increment on the view so there seems to be nothing wrong from the a code point of view, it's doing what you would expect.

Also works fine just using a non-interval Observer.

Am I doing something stupid here, or is this an actual bug?

*Originally created by @deadwards90 on 11/16/2016* When using the Angular2 SPA, I stripped down the application so there was nothing but complete bare bones. Just the home and app component, removed the nav bar etc. I then added the following: ``` import { Component } from '@angular/core'; import {Observable } from 'rxjs/Rx'; @Component({ selector: 'home', templateUrl: './home.component.html', }) export class HomeComponent { oJobs = Observable.interval(300); constructor() { } } ``` With the a template: ``` <h1>Hello, world!</h1> <ul> <span>{{oJobs | async}}</span> </ul> ``` Every time I run this, I get the following error: > Exception: Call to Node module failed with error: Prerendering timed out after 30000ms because the boot function in 'ClientApp/dist/main-server' returned a promise that did not resolve or reject. Make sure that your boot function always resolves or rejects its promise. You can change the timeout value using the 'asp-prerender-timeout' tag helper. Also it weirdly works OK if you were to comment out the binding on the HTML, run the application, then put it back in. When the refresh happens, the numbers increment on the view so there seems to be nothing wrong from the a code point of view, it's doing what you would expect. Also works fine just using a non-interval Observer. Am I doing something stupid here, or is this an actual bug?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1261
No description provided.