hello I am trying to render a single article by their id:
export class ArticleDetailsComponent {
article: Article=<Article>{};
constructor(private articleService: ArticleService) {}
getArticle(id: string): void {
this.articleService.get(id)
.subscribe({
next: (data) => {
this.article = data;
console.log(data);
},
error: (e) => console.error(e)
});
}
}
the html file:
@if (article) {
<p>{{article.id}}</p>
<p>{{article.title}}</p>
}
why does it not get rendered? the component gets loaded, I've tested it on my browser