Route Parameters - Angular (Tutorial #21)

Route Parameters in Angular - Tutorial no. 21. Sometimes we need part of the path in one or more of our routes (the URLs) to be a variable, a common example of this is an ID. Share this video:    • Route Parameters - Angular (Tutorial #21)   Watch complete FREE course here:    • Introduction- Angular (Tutorial #1)   Lets say we have a User and each User has an ID, the URLs for each User might look like: /user/1 /user/2 /user/3 and so on... But a better solution is to have one route with one component called UserComponent and pass to the UserComponent the number part of the URL. That’s called a parameterised route and we would implement it like so: const routes: Routes = [ { path: 'user/:id', component: UserComponent } ]; The path has a variable called id, we know it’s a variable since it begins with a colon : A path can have any number of variables as long as they all start with : and have different names. ActivatedRoute: Now we will read the parameter value in userComponent using ACtivatedRoute Class . ActivatedRoute class give us a snapshot object which will return the route parameters as object If you liked my channel , subscribe to it and like my videos. For any queries ask you question in comment section you can also connect with me @ Facebook:   / angularjs4beginners   LinkedIn:   / nisha-singla-82407aa0   Website : I hope you liked this Angular tutorial. If you are a beginner and facing any trouble in understanding the Route Parameters in Angular 5, feel free to drop the comment below and I'll be happy to help you at my best.