Routing Angular Applications: Lesson 9 of 23

Route Parameters

Up Next

Refactoring for User Service

Autoplaying in 7 seconds!


To get route parameters, we'll be using something called the ActivatedRoute from the @angular/router.

Once we have the ActivatedRoute, we can grab params using:

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


export class AboutUserComponent implements OnInit {

  constructor(private route: ActivatedRoute) {}

  ngOnInit() {
    // grab the current username
    let username = this.route.snapshot.params['username'];

    this.user = users.find(function(user) {
      return user.username === username;


Chris Sevilleja

168 posts

Co-founder of Slapping the keyboard until something good happens.