这是我的ts文件函数,会引发错误
post-list.componenet.ts
operator()
这是服务文件
ngOnInit() {
this.posts = this.postsService.getPosts();
this.postsSub = this.postsService.getPostUpdateListener()
.subscribe((posts: Post[]) => {
this.posts = posts});
}
}
我已经导入了'rxjs'依赖模块,我似乎无法确定如何纠正错误。 代码在浏览器上运行,但是我没有得到想要的输出
答案 0 :(得分:1)
别忘了在getPostUpdateListener()上返回数据
<style>
.small {
font-size: 12px;
}
.link {
text-decoration: underline;d
}
.headline {
font-size: 18px;
}
</style>