这里的情况是,service.ts
方法getMetadata(data)
将数据作为输入并存储在数组metaData = []
中。
要求是,当将数据推送到metaData = []
时,请调用方法getdata(metaData)
。
如何实现?请帮忙
public metaData = [];
getMetadata(data){
console.log("data");
this.metaData.push({data});
/* when all pushing of data into metaData =[] is finished,
then call a method getdata(metaData );*/
getdata(metaData );
}
getdata(metaData ){
/*------------------------*/
}
let Json1 = {
"viewBys":["usstate"];
}
this.dataService.getMetadata(Json1 ); //here sending "Json1 " as a parameter
let Json2 = {
"viewBys":["brand"];
}
this.dataService.getMetadata(Json2 ); //here sending "Json2 " as a parameter
let Json3 = {
"viewBys":["uscity"];
}
this.dataService.getMetadata(Json3 ); //here sending "Json3 " as a parameter