I'm making http request in angular. but values wont display in web page and also i'm using sample free api - https://reqres.in/api but this wont display any values.
here is my component.ts
@Component({
selector: 'app-value',
templateUrl: './value.component.html',
styleUrls: ['./value.component.css']
})
export class ValueComponent implements OnInit {
values: any;
constructor(private http: HttpClient) { }
ngOnInit() {
this.getValues();
}
getValues() {
return this.http.get<any>('https://reqres.in/api/users/2').subscribe(response => {this.values = response.any; });
}
}
and here is component.html
<ul>
<li *ngFor="let value of values">
{{ value.text }}
</li>
</ul>