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
		
			
				
	
	
		
			24 lines
		
	
	
		
			526 B
		
	
	
	
		
			TypeScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			526 B
		
	
	
	
		
			TypeScript
		
	
	
		
			Executable File
		
	
	
	
	
| // #docregion
 | |
| import { Injectable } from '@angular/core';
 | |
| 
 | |
| import { Observable } from 'rxjs/Observable';
 | |
| import 'rxjs/add/observable/of';
 | |
| import 'rxjs/add/operator/do';
 | |
| import 'rxjs/add/operator/delay';
 | |
| 
 | |
| @Injectable()
 | |
| export class AuthService {
 | |
|   isLoggedIn: boolean = false;
 | |
| 
 | |
|   // store the URL so we can redirect after logging in
 | |
|   redirectUrl: string;
 | |
| 
 | |
|   login(): Observable<boolean> {
 | |
|     return Observable.of(true).delay(1000).do(val => this.isLoggedIn = true);
 | |
|   }
 | |
| 
 | |
|   logout(): void {
 | |
|     this.isLoggedIn = false;
 | |
|   }
 | |
| }
 |