RxJS中的管道和选择操作符
我想知道以下两段代码是否以相同的方式运行: 带管道(来自原始ngrx): 没有一个:RxJS中的管道和选择操作符,rxjs,ngrx,Rxjs,Ngrx,我想知道以下两段代码是否以相同的方式运行: 带管道(来自原始ngrx): 没有一个: pending$ = this.store.select(fromAuth.selectLoginPagePending); error$ = this.store.select(fromAuth.selectLoginPageError); 我已经测试过了,没有发现任何明显的区别 想法?是的,你是对的。两者 pending$ = this.store.pipe(select(fromAuth.selectL
pending$ = this.store.select(fromAuth.selectLoginPagePending);
error$ = this.store.select(fromAuth.selectLoginPageError);
我已经测试过了,没有发现任何明显的区别
想法?是的,你是对的。两者
pending$ = this.store.pipe(select(fromAuth.selectLoginPagePending));
error$ = this.store.pipe(select(fromAuth.selectLoginPageError));
及
执行相同的功能,即获取存储状态的切片,如上的NgRX文档所述
但是,
pipe()
实用程序允许您将选择器与链接,例如scan()
,和filter()
,允许您执行其他操作,例如状态转换。是的,您是对的。两者
pending$ = this.store.pipe(select(fromAuth.selectLoginPagePending));
error$ = this.store.pipe(select(fromAuth.selectLoginPageError));
及
执行相同的功能,即获取存储状态的切片,如上的NgRX文档所述
但是,
pipe()
实用程序允许您将选择器与链接,例如scan()
,和filter()
,允许您执行其他操作,例如状态转换。它们都做相同的事情。
在内部,
store.select
函数调用select
操作符。它们都做相同的事情。
在内部,
store.select
函数调用select
操作符。这是否意味着在不添加更多操作符的情况下没有区别?这是否意味着在不添加更多操作符的情况下没有区别?
pending$ = this.store.select(fromAuth.selectLoginPagePending);
error$ = this.store.select(fromAuth.selectLoginPageError);