angular - 带角度的链式数组
问题描述
如何将数组发送到将使用数组所有实例的函数?我是这样做的:(标题是包含许多电影标题的数组)我需要获取每个标题的信息:
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); }
}
解决方案
推荐阅读
- android - 顶部操作栏阻止 Cardview
- r - 在 Travis 上使用 devtools 安装 R 包时遇到问题
- python - 为两个列表 separet.py 组合每个项目
- c# - 使用 Novell LDAP 在 .NET Core 中针对 AD 进行页面 LDAP 查询
- mysql - 在 if 语句中插入 SQL 问题
- c - recvmsg() 如何在不违反严格别名的情况下将消息控制到堆栈缓冲区?
- php - PHP MYSQL 联合查询
- xml - 如何使用 serde_xml_rs 根据标签名称将 XML 反序列化为不同的结构?
- r - 如何在 n 位数字前提取 1 或 2 个单词?
- postgresql - 从特定函数创建通用函数(重构)