Created
May 19, 2022 08:10
-
-
Save NetanelBasal/a0c32a01bcc8c4d6bec18ba9b33c32cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { inject } from '@angular/core'; | |
import { ActivatedRoute } from '@angular/router'; | |
export function getRouteParam(key: string) { | |
return inject(ActivatedRoute).snapshot.params[key]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-todo-page', | |
templateUrl: './todo-page.component.html', | |
}) | |
export class TodoPageComponent { | |
id = getRouteParam('id'); | |
ngOnInit() { | |
console.log(this.id) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment