Skip to content
Loading
0
  • Rijwan Ansari
    0
    You can do in this if you want read parameters from URL.
     
    1. First import ActivatedRoute from ‘@angular/router’
    2. Inject ActivatedRoute class in constructor.
    3. Access queryParams property of ActivatedRoute class which returns an observable of the query parameters that are available in the current URL route.
     
    Example:
    1. import { ActivatedRoute } from '@angular/router';  
    2.   
    3. @Component({ ... })  
    4. export class BookComponent implements OnInit {  
    5.     
    6.   orderby: string;  
    7.     
    8.   constructor(private route: ActivatedRoute) { }  
    9.   
    10.   ngOnInit() {  
    11.     this.route.queryParams  
    12.       .subscribe(params => {  
    13.         console.log(params);   
    14.         this.claim_doc_code = params.cl_doc_code;  
    15.        this.claim_doc_year = params.cl_doc_year;  
    16.         this.claim_doc_no = params.cl_doc_no;  
    17.       }  
    18.     );  
    19.   }  
    20. }  
     Check this for more details: https://www.angularjswiki.com/angular/get-query-parameters-in-angular/
    0