"Fossies" - the Fresh Open Source Software Archive

Member "angular-13.3.9/aio/content/examples/router/src/app/admin/admin-dashboard/admin-dashboard.component.1.ts" (18 May 2022, 828 Bytes) of package /linux/www/angular-13.3.9.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 @Component({
    8   selector: 'app-admin-dashboard',
    9   templateUrl: './admin-dashboard.component.html',
   10   styleUrls: ['./admin-dashboard.component.css']
   11 })
   12 export class AdminDashboardComponent implements OnInit {
   13   sessionId!: Observable<string>;
   14   token!: Observable<string>;
   15 
   16   constructor(private route: ActivatedRoute) {}
   17 
   18   ngOnInit() {
   19     // Capture the session ID if available
   20     this.sessionId = this.route
   21       .queryParamMap
   22       .pipe(map(params => params.get('session_id') || 'None'));
   23 
   24     // Capture the fragment if available
   25     this.token = this.route
   26       .fragment
   27       .pipe(map(fragment => fragment || 'None'));
   28   }
   29 }