Moved all heroes functionality into milestone 2 Crisis Center initial functionality is milestone 3 Admin feature module as milestone 4 including route guard examples Updated milestone 5 to lazy load admin feature module Added examples for CanLoad, CanActivateChildren guard, component-less routes Added section on explanation of ActivatedRoute Added section on animating route components Added section on relative navigation
		
			
				
	
	
		
			34 lines
		
	
	
		
			841 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			841 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docregion
 | |
| import { Component, OnInit }  from '@angular/core';
 | |
| import { ActivatedRoute }     from '@angular/router';
 | |
| import { Observable }         from 'rxjs/Observable';
 | |
| import 'rxjs/add/operator/map';
 | |
| 
 | |
| @Component({
 | |
|   template:  `
 | |
|     <p>Dashboard</p>
 | |
| 
 | |
|     <p>Session ID: {{ sessionId | async }}</p>
 | |
|     <a id="anchor"></a>
 | |
|     <p>Token: {{ token | async }}</p>
 | |
|   `
 | |
| })
 | |
| export class AdminDashboardComponent implements OnInit {
 | |
|   sessionId: Observable<string>;
 | |
|   token: Observable<string>;
 | |
| 
 | |
|   constructor(private route: ActivatedRoute) {}
 | |
| 
 | |
|   ngOnInit() {
 | |
|     // Capture the session ID if available
 | |
|     this.sessionId = this.route
 | |
|       .queryParams
 | |
|       .map(params => params['session_id'] || 'None');
 | |
| 
 | |
|     // Capture the fragment if available
 | |
|     this.token = this.route
 | |
|       .fragment
 | |
|       .map(fragment => fragment || 'None');
 | |
|   }
 | |
| }
 |