Hey! My name is Sebastian Müller.
I'm a Software Architect from Hamm, Germany.

Get in touch with me:
| Github | LinkedIn

Angular 2 Router - Resolving Data for Routes

Angular 2 has an awesome router with a lot of useful features that makes it possible to write large, modular Angular applications. Today, I want to talk about a feature that you may know when you’ve used AngularJS and the UI-Router before - resolving data for routes. Let’s say we have two simple routes in our application: @NgModule({ imports: [ BrowserModule, RouterModule.forRoot([ { path: '', component: HomepageComponent }, { path: 'users', component: UsersComponent } ]) ], providers: [], bootstrap: [RootComponent], declarations: [RootComponent, HomepageComponent, UsersComponent] }) export class AppModule {} HomepageComponent: Displays some static content - nothing special UsersComponent: Displays a list of users - the users data comes from a REST API Now that the UsersComponent fetches the data from a backend, we want to make sure that the data is fetched before the users page is displayed.

Preloading Routes in Angular 2.1

A few days after the 2.0.0 release of Angular, the Angular team has already released the first beta version of Angular 2.1, which comes with a niftly little performance feature for the @angular/router that I want to show you today. Note that the API may change in the future. Preloading resources When loading resources in the browser, we have the option to tell the browser that it should preload certain assets that the user will eventually need when he triggers an action (e.g.