问题描述
如何从控制器CI4中的ajax获取数据?
of(x)
这是AJAX呼叫
rxjs/testing
这是我从视图中输入的内容
it('test',() => {
// might want to add this in a `beforeEach` function
let testScheduler = new TestScheduler(
(actual,expected) => (console.log({actual,expected}),expect(actual).toEqual(expected))
);
testScheduler.run(({ hot,expectObservable }) => {
const e1 = hot( '--1^---2----3-|');
const e2src = hot( '-a-^-b-----c--|');
const e2 = new BehaviorSubject(undefined);
const result = e1.pipe(
concatMap(x => of(x).pipe(
withLatestFrom(e2))
)
);
const source = merge(
result,e2src.pipe(
tap(value => e2.next(value)),// this is important as we're not interesting in `e2src`'s values
// it's just a way to `Feed` the `e2` BehaviorSubject
ignoreElements()
)
);
expectObservable(source).toBe('----x----y-|',{
x: ['2','b'],y: ['3','c']
});
});
})
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)