Angular 利用路径观测的角转移
我尝试将对象发送到新组件。为此,我创建了以下方法:Angular 利用路径观测的角转移,angular,routing,Angular,Routing,我尝试将对象发送到新组件。为此,我创建了以下方法: getRecord(blogId: Observable<Note>) { this.router.navigate(['/blogdetail'], { queryParams: { Id: blogId}}); }获取更多帮助需要包括的内容:您的路由配置、您尝试点击的url、路由前blogId的值。获取更多帮助需要包括的内容:您的路由配置、您尝试点击的url、路由前blogId的值。 interface Note{ im
getRecord(blogId: Observable<Note>) {
this.router.navigate(['/blogdetail'], { queryParams: { Id: blogId}});
}获取更多帮助需要包括的内容:您的路由配置、您尝试点击的url、路由前blogId的值。获取更多帮助需要包括的内容:您的路由配置、您尝试点击的url、路由前blogId的值。
interface Note{
imageUrl: string;
title: string;
body: string;
}
ngOnInit(): void {
this.route.queryParams.subscribe(params => {
this.note = params['Id'];
const blogtitle = this.note['title'];
const blogbody =this.note['body'];
const image =this.note['imageUrl'];
this.imageUrl = image;
this.title = blogtitle;
this.body = blogbody;
});
window.scrollTo(0, 0);