如何将数组发送到将使用数组所有实例的函数? 我这样做是这样的:(标题是包含许多电影标题的数组)我需要获取每个标题的信息:
export class AppComponent {
constructor(private _httpClient: HttpClient) {}
results: any = [];
title: string[] =["Jurassic World","Titanic"];
apiUrl = 'http://www.omdbapi.com/?apikey=89089a31&t=';
getMovies(title) {
this._httpClient.get(this.apiUrl+ this.title)
.subscribe((data: any) => {
this.results = data.Search;
console.log(this.results);
})}
ngOnInit() {
this.getMovies(this.title); }
}