The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Configure Your First Angular 2 Route

Configure Your First Angular 2 Route

3:31
Using the Angular 2 router requires defining routes, passing them in to the `RouterModule.forRoot` and then importing the configured `RouterModule` into your main App Module.
Watch this lesson now
Avatar
egghead.io

Using the Angular 2 router requires defining routes, passing them in to the RouterModule.forRoot and then importing the configured RouterModule into your main App Module.

Avatar
Cameron Bourgeois

Exporting RouterModule as default doesn't work with the latest Angular 2. I had to modify it as a module and do:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthComponent } from './auth/auth.component';

const routes: Routes = [
{ path: '', component: AuthComponent }
];

@NgModule({
imports: [
RouterModule.forRoot(routes)
],
exports: [
RouterModule
]
})
export class AppRoutingModule {}

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?