Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

angular get url params

import { ActivatedRoute } from "@angular/router";

//import ActivatedRoute in constructor()
private $route: ActivatedRoute

// in ngOnInit() call
//myvar is the variable where you want to store your param
this.$route.params.forEach(param =>
	this.myvar = param['whatever your param name is']
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #angular #url #params
ADD COMMENT
Topic
Name
8+6 =