Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from 'angular2/core';
- import { NgIf } from 'angular2/common';
- import { RouteConfig, ROUTER_DIRECTIVES, AsyncRoute } from 'angular2/router';
- import { CrisisCenterComponent} from './crisis-center/crisis-center.component';
- import { IdentityServerAuth } from './auth.component'
- declare var System: any;
- @Component({
- selector: 'app',
- template: `
- <a href="javascript:void(0)" (click)="auth.login()" *ngIf="auth.isLoggedIn === false">Login</a>
- <a href="javascript:void(0)" (click)="auth.logout()" *ngIf="auth.isLoggedIn">Logout</a>
- <router-outlet></router-outlet>
- `,
- directives: [ROUTER_DIRECTIVES]
- })
- @RouteConfig([
- {
- path: '/crisis-center/...',
- name: 'CrisisCenter',
- component: CrisisCenterComponent,
- useAsDefault: true
- },
- new AsyncRoute({
- path: '/private',
- name: "PrivateRoute",
- loader: () => ComponentHelper.LoadComponentAsync('PrivateRoute', '../app/private/private-route.component')
- }),
- ])
- export class AppComponent
- {
- constructor(public auth: IdentityServerAuth)
- {
- }
- }
- class ComponentHelper
- {
- static LoadComponentAsync(name, path)
- {
- return System.import(path).then(c => c[name]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement