"Fossies" - the Fresh Open Source Software Archive

Member "angular-8.2.14/aio/content/examples/router/src/app/admin/admin-dashboard/admin-dashboard.component.ts" (13 Nov 2019, 1103 Bytes) of package /linux/www/angular-8.2.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // #docregion
    2 import { Component, OnInit }    from '@angular/core';
    3 import { ActivatedRoute }       from '@angular/router';
    4 import { Observable }           from 'rxjs';
    5 import { map }                  from 'rxjs/operators';
    6 
    7 import { SelectivePreloadingStrategyService } from '../../selective-preloading-strategy.service';
    8 
    9 @Component({
   10   selector: 'app-admin-dashboard',
   11   templateUrl: './admin-dashboard.component.html',
   12   styleUrls: ['./admin-dashboard.component.css']
   13 })
   14 export class AdminDashboardComponent implements OnInit {
   15   sessionId: Observable<string>;
   16   token: Observable<string>;
   17   modules: string[];
   18 
   19   constructor(
   20     private route: ActivatedRoute,
   21     preloadStrategy: SelectivePreloadingStrategyService
   22   ) {
   23     this.modules = preloadStrategy.preloadedModules;
   24   }
   25 
   26   ngOnInit() {
   27     // Capture the session ID if available
   28     this.sessionId = this.route
   29       .queryParamMap
   30       .pipe(map(params => params.get('session_id') || 'None'));
   31 
   32     // Capture the fragment if available
   33     this.token = this.route
   34       .fragment
   35       .pipe(map(fragment => fragment || 'None'));
   36   }
   37 }