Answer the question
In order to leave comments, you need to log in
How to update the data of the "child" model?
Hello everybody!
There are news with tags attached to them, that is, the News model is as follows:
import {Tags} from "./Tags";
export class News{
id: number;
title: string;
text: string;
tags: Tags;
}
this.http.get<News>('http://site.ru/api/add_news?news_id=' + news_id)
.subscribe(
data => { this.news = data; },
error => { });
<div *ngFor="let item of news">
<p> {{item.title}} </p>
<p> {{item.text}} </p>
</div>
this.http.get<Tags>('http://site.ru/api/add_tags?tag_name=' + tag_name)
.subscribe(
data => { this.tags = data; },
error => { });
<div *ngFor="let item of news">
<p> {{item.title}} </p>
<p> {{item.text}} </p>
<div name="tags" *ngFor="let tag of item.tags">
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question