In app.component.ts I receive data via API:
export class AppComponent implements OnInit{
constructor(private http: HttpClient){}
items: Object;
getApi(){
return this.http.get("https://reqres.in/api/user");
}
ngOnInit(){
this.getApi().subscribe( data => {
this.items = data
console.log(this.items)
})
}
}
In my app.component.html I output that data:
<ul *ngIf="items">
<li *ngFor="let item of items.data">
{{ item.id }} {{ item.name }} {{ item.year }}
</li>
</ul>
My question is, whether you can change the id with a string connected to the integer of the id. For example id = 1 => 1 means string "one" , id = 2 => means string "two".
Sadly I do no know how to change the value of the received data with a new value.
I hope it is clear what I want to achieve, if not do not hesitate to ask!
I hope you can help me. Thank you!