Reputation: 4998
I'm using JSONPlaceholder with Angular. I'm learning these things so my question may not be framed very well. I carefully followed the documentation and I'm getting correct output also. But there is something extra that I'm getting with every object. See,
In this example I'm fetching the record with id: 1
. But later there will be thousands of such records and it will look very dirty. But there is no such thing mentioned in their entire documentation. How do I filter this out. My typescript code is extremely simple.
card.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
...
})
export class CardsComponent implements OnInit {
constructor() { }
ngOnInit() {
this.fetchAllRecords();
}
fetchAllRecords() {
fetch('https://jsonplaceholder.typicode.com/albums/1')
.then(response => response.json())
.then(json => console.log(json))
}
}
And here I've created an stackblitz also. Please correct me.
Upvotes: 0
Views: 896
Reputation: 1468
Your API call is working. That's all it loads are the fields of id, title and userId. That thing below is just something you can ignore. It's basically just irrelevant info to show browser properties of the object that you are already displaying above.
Upvotes: 0