我有一个我想要过滤的数组..听起来很简单我知道.
但是当我做,我仍然得到整个数组…
@H_502_21@但是当我做,我仍然得到整个数组…
constructor(http:Http) { this._val = Math.random(); let s = http.get('https://secure.digitalsignage.com/Digg'); s.map(s => { let news = JSON.parse(s._body); return Rx.Observable.fromArray(news); }).filter(function(data) { console.log('all array ' + data); return true; }).subscribe(function (v) { console.log(v); }); }
所以在console.log(‘所有数组’数据);我得到整个数组而不是一个数组成员的流,为什么?
这里是调试快照:
我知道我不是疯了,因为这样可以预期:
Rx.Observable.fromArray([1,2,3,4,5]).filter(function (v) { if (v < 3) return true return false; }).subscribe(function (v) { console.log(v); })
是什么赋予了?
tx阅读,
肖恩.