Answers for "read param value from url in angualr"

7

angular get url param

constructor(private activatedRoute: ActivatedRoute) {
  this.activatedRoute.queryParams.subscribe(params => {
        let date = params['startdate'];
        console.log(date); // Print the parameter to the console. 
    });
}
Posted by: Guest on November-25-2020
0

angular url parameter

// example url: details?id=2

constructor(private activatedRoute: ActivatedRoute) {
  this.activatedRoute.queryParams.subscribe(params => {
        console.log(params); // Prints {id: "2"}
    });
}
Posted by: Guest on February-24-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language