Skip to content

Instantly share code, notes, and snippets.

@sonicoder86
Created June 25, 2016 08:37
Show Gist options
  • Save sonicoder86/0c4027882bf4039eab6590c875b7bb2b to your computer and use it in GitHub Desktop.
Save sonicoder86/0c4027882bf4039eab6590c875b7bb2b to your computer and use it in GitHub Desktop.
Authentication in Angular 2 - part 1
// app.component.ts
import { Component } from '@angular/core';
import { RouteConfig, RouterOutlet } from '@angular/router-deprecated';
import { HomeComponent } from './home.component';
import { LoginComponent } from './login.component';
import { ProfileComponent } from './profile.component';
@Component({
selector: 'auth-app',
directives: [RouterOutlet],
template: `
<div class="container body-container">
<router-outlet></router-outlet>
</div>
`
})
@RouteConfig([
{ path: '/', component: HomeComponent, name: 'Home', useAsDefault: true },
{ path: '/login', component: LoginComponent, name: 'Login' },
{ path: '/profile', component: ProfileComponent, name: 'Profile' }
])
export class AppComponent {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment