I am in dev mode doing simple testing using angular2 universal.
I get this message in the logs:
WARNING: your application is taking a long time to render the application
I concur....jeesh its takes several seconds to load. How do I reslove? I am running locally on my mac.
So from time it takes to make a requests is about 90 seconds. My api server is then hit and I see 2 requests. So its not the api server which is flask fyi. If I reload the same request then fast. Only new endpoint.
Here is my app component:
import { Component, OnInit } from '@angular/core';
import {RouterLink,Router,ActivatedRoute,ROUTER_DIRECTIVES} from '@angular/router';
import { TestService } from '../service/test.service';
@Component({
moduleId: __filename,
directives: [RouterLink,ROUTER_DIRECTIVES],
providers: [ TestService],
styles: [],
template: `
{{state}}
<br>
{{city}}
<br>
{{report_list | json}}
`
})
export class TestComponent implements OnInit {
isLoading=true;
state:string;
city:string;
report_list: any[] = [];
constructor(private route: ActivatedRoute,
private _TestService:TestService
) { }
ngOnInit() {
this.route.params.map(params => params['state'])
.subscribe(state => { this.state=state });
this.route.params.map(params => params['city'])
.subscribe(city => { this.city=city });
this._TestService.getData(this.state,this.city)
.subscribe(report_list => this.report_list = report_list,
null,() => { this.isLoading = false; });
}
}