0
我想重复我的变量线程:迭代在流
threads: Subject<{[key: string]: Thread }> = new BehaviorSubject({});
尽管我多次尝试:
return this.threads.asObservable().map((threadDictionary: {[key: string]: Thread}) => {
for(let key in threadDictionary) {
console.log("key", threadDictionary[key]);
if(threadDictionary[key].participants[0].name.startsWith(str)) {
return threadDictionary[key];
}
}
});
return this.threads.map((threadDictionary: {[key: string]: Thread}) => {
.flatMap((threadDictionary: {[key: string]: Thread}) => {
for(let key in threadDictionary) {
console.log("key", threadDictionary[key]);
if(threadDictionary[key].participants[0].name.startsWith(str)) {
return threadDictionary[key];
}
}
});
});
////////////// /////// 编辑 /////////////////////
return this.threads.asObservable().map((threadDictionary: {[key: string]: Thread}) => {
return threadDictionary[key];
});
for(let key in threadDictionary) {
console.log("key", threadDictionary[key]);
if(threadDictionary[key].participants[0].name.startsWith(str)) {
return threadDictionary[key];
}
}
我想知道这是可能创造一个For循环在我的可变线程上。我应该改变它的变量类型吗?或者如何使这个循环?
对不起,我不明白你的解决方案。 我发表了我的文章,但我不认为它是这样的.. – Floriane
你有一个例子吗? – Floriane
查看我刚刚提供的示例。 –