I want to test my loading bar for a component. Using the router I am switching between components when a nav link is pressed.
Whats an easy way to make a component take a long time to load?
I want to test my loading bar for a component. Using the router I am switching between components when a nav link is pressed.
Whats an easy way to make a component take a long time to load?
You can put a resolver on the route that returns a delayed stream. This answer mentions doing this.
Here is an example pulled from Alligator IO
@Injectable()
export class HnResolver implements Resolve<Observable<string>> {
constructor() {}
resolve() {
return Observable.of('Hello Alligator!').delay(2000);
}
}