[Angular] Ngrx/effects, Action trigger another action
@Injectable()
export class LoadUserThreadsEffectService { constructor(private action$: Actions, private threadsService: ThreadsService) {
} @Effect()
userThreadsEffect$: Observable<Action> = this.action$
.ofType(LOAD_USER_THREADS_ACTION)
.switchMap((action) => this.threadsService.loadUserThreads(action.payload))
.map((allUserData) => new LoadUserThreadsSuccess(allUserData)); @Effect()
userSelectedEffect$: Observable<Action> = this.action$
.ofType(USER_SELECTED_ACTION)
.map((action) => new LoadUserThreadsAction(action.payload))
}
For the first Effect,
LOAD_USER_THREADS_ACTION
will trigger another action:
.map((allUserData) => new LoadUserThreadsSuccess(allUserData));
Second effect:
.ofType(USER_SELECTED_ACTION)
will trigger another action:
.map((action) => new LoadUserThreadsAction(action.payload))
[Angular] Ngrx/effects, Action trigger another action的更多相关文章
- [Angular] Improve Server Communication in Ngrx Effects with NX Data Persistence in Angular
Communicating with a remote server via HTTP presents an extra level of complexity as there is an inc ...
- 深入理解MVVM模式中Silverlight的Trigger、Action和Behavior及Silverlight的继承机制
接触Silverlight已经有两三个月了,开始一直感觉他和Winform很相似,拖拖控件就行了,所以一直把经历放在了研究后台和服务器交互和性能优化上面,很少去仔细研究Silverlight的页面.前 ...
- ngRx 官方示例分析 - 2. Action 管理
我们从 Action 名称开始. 解决 Action 名称冲突问题 在 ngRx 中,不同的 Action 需要一个 Action Type 进行区分,一般来说,这个 Action Type 是一个字 ...
- [Angular2] @Ngrx/store and @Ngrx/effects learning note
Just sharing the learning experience related to @ngrx/store and @ngrx/effects. In my personal opinio ...
- [Angular] NgRx/effect, why to use it?
See the current implementaion of code, we have a smart component, and inside the smart component we ...
- struct2的structs.xml文件配置There is no Action mapped for action name 问题
很久没写过博客,今天重新开始写,新技术太多,只有通过博客才可以不断积累,本人水平有限,如有错误,欢迎指正,谢谢 今天在MAVEN上配置web project的struct2,发现自己忽略了很多问题,再 ...
- [Microsoft Dynamics CRM 2016]Invalid Action – The selected action was not valid 错误的诱因及解决方法
详细问题描述: 由于解决windows server 评估版过期\SQL server 评估版过期的问题后而导致的Invalid Action – The selected action was no ...
- There is no Action mapped for namespace [/pages/action/student] and action name [findStudent]
1.错误描写叙述 2014-7-13 2:38:54 org.apache.jasper.compiler.TldLocationsCache tldScanJar 信息: At least one ...
- 实现Action(含Action访问ServletAPI)
Action里是否包含实例变量不重要,重要的是包含setter和getter方法. Action可用于封装请求参数和处理结果.jsp中使用struts2输出:<s:property value= ...
随机推荐
- gulp几个常见问题及解决方案
1. 找不到local gulp 报错代码: $ gulp [23:29:31] Local gulp not found in [23:29:31] Try running: npm install ...
- JavaScript学习总结(1)——JavaScript基础
一.JavaScript语言特点 1.1.JavaScript是基于对象和事件驱动的(动态的) 它可以直接对用户或客户输入做出响应,无须经过Web服务程序.它对用户的响应,是采用以事件驱动的方式进行的 ...
- Microsoft SQL Server Version List(SQL Server 版本)
原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Servic ...
- HTML5梦幻星空,可用作网页背景
<html> <head> <title>星空</title> <META http-equiv="X-UA-Compatible&qu ...
- 转 openssl 建立服务器证书
openssl 建立服务器证书 ## 1,建立目录和文件 set path=D:/openssl/bin D: cd D:/openssl/conf/ ren ope ...
- HTML基础第三讲---字体
转自:https://i.cnblogs.com/posts?categoryid=1121494 同样我们在这里继续讲一下它的body,因为它能直观的让大家观察到你所学到的成果. 这一讲,我们来学习 ...
- PatentTips - Apparatus and method for a generic, extensible and efficient data manager for virtual peripheral component interconnect devices (VPCIDs)
BACKGROUND A single physical platform may be segregated into a plurality of virtual networks. Here, ...
- debian 9 安装后需做的几件事
debian 9 安装后需做的几件事 安装环境:X86 >> Debian 9 Linux/GNU apt源更新 注意连上有线网络 刚安装好的debian系统中,/etc/apt/sour ...
- JS面向对象程序设计(OOP:Object Oriented Programming)
你是如何理解编程语言中的面向对象的? 我们研究JS和使用JS编程本身就是基于面向对象的思想来开发的,JS中的一切内容都可以统称为要研究的“对象”,我们按照功能特点把所有内容划分成“几个大类,还可以基于 ...
- 使用Profiles分析SQL语句运行时间和消耗资源
打开profiling,默认是没开启的. mysql> set profiling=1; 运行要分析的SQL语句 mysql> select count(1) from wechat_em ...