Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
export function getRouteParam(key: string) {
return inject(ActivatedRoute).snapshot.params[key];
selector: 'app-todo-page',
templateUrl: './todo-page.component.html',
export class TodoPageComponent {
id = getRouteParam('id');
ngOnInit() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment