我有字符串数组FidId,我需要将此数组传递给另一个组件使用
#find all Transactions where, in the past hour,
# 1. the number of unique CC used > 2, OR
# 2. the total amount paid > 180
DF[ un_cc_hr > 2 | am_hr > 180, ]
# Transaction Time Email CC Amount cc_hr un_cc_hr am_hr
# 1: 80 2020-01-01 02:03:05 AAB 1021 94 1089-1021 2 194
# 2: 66 2020-01-01 01:35:32 AAD 1199 60 1152-1020-1199 3 209
# 3: 78 2020-01-01 02:00:16 AAD 1152 63 1152-1020-1199-1152 3 272
# 4: 27 2020-01-01 00:40:50 BAA 1080 100 1169-1080 2 186
# 5: 53 2020-01-01 01:24:46 BAA 1096 100 1080-1140-1096 3 259
# 6: 87 2020-01-01 02:15:24 BAA 1029 71 1140-1096-1029 3 230
# 7: 90 2020-01-01 02:19:30 BAA 1120 93 1096-1029-1120 3 264
# 8: 33 2020-01-01 00:55:52 BBC 1031 55 1196-1169-1031 3 171
# 9: 64 2020-01-01 01:34:58 BDD 1093 78 1154-1052-1093 3 212
# 10: 42 2020-01-01 01:08:04 CBC 1052 96 1022-1052 2 194
# 11: 68 2020-01-01 01:40:07 CBC 1085 100 1022-1052-1085 3 294
# 12: 38 2020-01-01 01:03:34 CCA 1073 81 1090-1142-1073 3 226
# 13: 98 2020-01-01 02:40:40 CCC 1121 86 1158-1121 2 183
# 14: 21 2020-01-01 00:35:54 DBB 1025 67 1194-1042-1025 3 212
# 15: 91 2020-01-01 02:20:33 DDA 1109 99 1115-1024-1109 3 236
这是我需要的地方
我是新手,所以请帮忙:)
答案 0 :(得分:0)
我将孩子从任何参数传递给父母的方式(在我看来,这就是您所需要的)
首先在子组件中,定义eventEmitter并初始化要传递给父母的数组
//child component.ts
array: any[] = [];
@Output() passArray = new Eventemitter
然后我编写一个函数,该函数调用我的事件发射器并发出这样的数组
// child component.ts
emitArray() {
this.passArray.emit(array);
}
现在,我进入子组件所在的父组件的HTML 在这里,我可以将eventEmitter放在这样的括号中
// parent component.html
<custom-component (passArray)="yourFunction($event)"><custom-component>
// parent component.ts
yourFunction(parameter) {
do.something()
}
因此,一旦调用passArray.emit称为我们在html中侦听它的父组件,它就会执行“ yourFunction”,并从$ event获取参数。 $ event是我们在子组件中传递的数据。有关如何按角度传递数据的更多详细信息,请阅读https://angular.io/docs上的文档。他们在解释许多主题方面做得很好:)(比我好:D)
这是我的第一个回答,如果有点混乱,请耐心等待:)我希望我能提供帮助;)