是什么在Angular2 OnPushObserve和OnPush之间的区别? [英] What's the difference between OnPushObserve and OnPush in Angular2?

查看:143
本文介绍了是什么在Angular2 OnPushObserve和OnPush之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么在Angular2 OnPushObserve和OnPush之间的区别?
我知道所有关于onPush战略和观测量..但是不知道这两者之间的区别......也许NG2开发可共享更多信息...

What's the difference between OnPushObserve and OnPush in Angular2? I know all about onPush strategy and Observables.. but wondering the difference between these two... maybe ng2 dev can share more info...

文档似乎已经过时: https://angular.io/文档/ JS /最新/ API /核心/ ChangeDetectionStrategy-enum.html

关于

肖恩(角2样板应用程序: http://ng2.javascriptninja.io

Sean ( Angular 2 Boilerplate App: http://ng2.javascriptninja.io)

推荐答案

更新16年3月4日

从Angular2 的changelog

From Angular2 changelog:

OnPushObserve是飞镖的实验特性,有概念上的性能问题,如设置观测缓慢。使用OnPush来代替。

OnPushObserve was an experimental feature for Dart and had conceptual performance problems, as setting up observables is slow. Use OnPush instead.

INITIAL

参照 NG-BOOK2 教程说明,如果一个组件依赖于观察输入值(流)和变化检测策略被指定为OnPushObserve,

Referring to ng-book2 tutorial description, If a component depends on observable inputs (streams), and change detection strategy is specified as OnPushObserve,

然后角将认购上投入的变化,当发出一个新的事件触发更新。

then Angular will subscribe for changes on inputs and trigger an update when a new event is emitted.

据我了解:


  • OnPush是,如果组件依赖于一成不变的输入使用的策略。

  • 是,如果组件依赖于观察输入使用OnPushObserve策略。

所有似乎很清楚,除了从角文档是混乱的。

All seems clear, except that statement from current version of Angular docs is confusing.

OnPushObserve - 这是一个实验性的功能。仅在飞镖。

OnPushObserve - This is an experimental feature. Works only in Dart.

这篇关于是什么在Angular2 OnPushObserve和OnPush之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆