【发布时间】:2019-02-22 00:30:00
【问题描述】:
我正在尝试从 omdbapi 获取电影数据,但我无法在 html 中打印此值
.ts
import { Component, } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(private _httpClient: HttpClient) {}
results: any = [];
getMovies(title) {
`enter code here`
this._httpClient.get("http://www.omdbapi.com/?apikey=d5dc2a5a&s=" + title)
.subscribe((data) => {
this.results = data;
//this.results.Search;
console.log(this.results)
})
}
}
控制台价值
【问题讨论】:
标签: arrays angular typescript observable angular6