加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

ngrx-router与angular2路由器

发布时间:2020-12-17 10:16:41 所属栏目:安全 来源:网络整理
导读:使用 ngrx/router而不是新的angular2路由器有什么好处和缺点.我目前使用弃用的beta路由器,我想评估我的机会. 这是与现已弃用的beta路由器 https://gitter.im/ngrx/store?at=5710e4fc5cd40114649b9399的比较 the main differences between the component rout
使用 ngrx/router而不是新的angular2路由器有什么好处和缺点.我目前使用弃用的beta路由器,我想评估我的机会.
这是与现已弃用的beta路由器 https://gitter.im/ngrx/store?at=5710e4fc5cd40114649b9399的比较

the main differences between the component router and ngrx/router are the decisions behind the design. The component router takes a more internal approach when it comes to components if you look at the lifecycle hooks. Our router doesn’t require that the router hook into your components so any component is routable. Another difference is the use of observables. The component router uses promises to handle its lifecycle,whereas ours uses observables because they lend themselves to more of a reactive approach. Our route/query parameters are observable which makes reusing components when parameters change easier. Our router has more streams available for you to subscribe to and react upon. The overall idea is that the browser URL itself is a stream and we are turning that stream into a view of rendered routes. Both routers have a concept of lazy loading,protecting routes,resolving data and lifecycle events. Both still have gaps that need to be filled. If you prefer a more observable approach,our router works very nicely with that.

新的angular2路由器将更接近今天的ngrx /路由器,所以如果您现在使用已弃用的beta路由器,请继续使用,直到新路由器被释放然后迁移.如果你从零开始,我会说使用ngrx / router,因为它为新路由器提供了一个相对简单的迁移路径.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读