I have created fake API using jsonplaceholder rendering into list. i got an output what i am expected but one compiler error as below i got output what i am expecting but one compiler error**
ERROR in src/app/posts/posts.component.ts:14:8 - error TS2696: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'any[]': length, pop, push, concat, and 26 more.
14 this.posts = response;
This is my .ts
import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpErrorResponse, HttpResponse } from '@angular/common/http';
@Component({
selector: 'posts',`enter code here
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.css']
})
export class PostsComponent {
posts : any[];
constructor(private http:HttpClient) {
http.get("http://jsonplaceholder.typicode.com/posts")
.subscribe(response => {
this.posts = response;
});
}
}
this is my template file
<ul class="list-group">
<li
*ngFor="let post of posts"
class="list-group-item">
{{post.body}}
</li>
</ul>