constructor(private recipeService : RecipeService , private route : ActivatedRoute) { }
ngOnInit() {
const id = this.route.params['id'];
const id = this.route.snapshot.params['id'];
}
Run Code Online (Sandbox Code Playgroud)
角度中的route.snapshot.params和route.params有什么区别我们什么时候应该使用route.snapshot.params,什么时候应该使用route.params
angular ×1