39577

What's the difference between OnPushObserve and OnPush in Angular2?

Question:

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...

docs seems outdated: <a href="https://angular.io/docs/js/latest/api/core/ChangeDetectionStrategy-enum.html" rel="nofollow">https://angular.io/docs/js/latest/api/core/ChangeDetectionStrategy-enum.html</a>

regards

Sean ( Angular 2 Boilerplate App: <a href="http://ng2.javascriptninja.io" rel="nofollow">http://ng2.javascriptninja.io</a>)

Answer1:

UPDATE 04 Mar 16

From Angular2 <a href="https://github.com/angular/angular/blob/master/CHANGELOG.md" rel="nofollow">changelog</a>:

<blockquote>

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

</blockquote>

INITIAL

Referring to <a href="https://www.ng-book.com/2/" rel="nofollow">ng-book2</a> tutorial description, If a component depends on observable inputs (streams), and change detection strategy is specified as OnPushObserve,

<blockquote>

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

</blockquote>

As I understand it:

<ul><li>OnPush strategy is used if the component depends on immutable inputs.</li> <li>OnPushObserve strategy is used if the component depends on observable inputs.</li> </ul>

All seems clear, except that statement from current version of <a href="https://angular.io/docs/ts/latest/api/core/ChangeDetectionStrategy-enum.html" rel="nofollow">Angular docs</a> is confusing.

<blockquote>

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

</blockquote>

Recommend

  • Create a multiple horizontal line plot, plotting numerous variable for multiple years
  • TFS2018 why is shelveset name empty?
  • Complex ruby array of hashes combine
  • Bypass Gmail's spam filter (mails sent with PHP from a shared host)
  • apt-get update fails with 404 in a previously working build
  • Laravel Artisan PHP version error in 1and1 server
  • Aligning grid lines in R, bReeze package
  • Highcharts: display multiple tooltips by click and vice versa
  • How to supress header Vary:* when using OutputCacheProfiles
  • What is the best practise to organize different applications under VOBs
  • pseudocolors in R
  • Excluding dates in the jQuery datepicker using beforeShowDay and an array of objects
  • LoadRunner correlation phenomen?
  • Calculate Event Durations to only part within Sliced Period
  • Cumulative sum of values by month, filling in for missing months
  • Remove PNG plot margins
  • Checking if URL exists - HTTP Request always returns an exception
  • Get enum value from string
  • How can I use C++ enum types like C#?
  • What is a good persistence design for this entity hierarchy?
  • Accessing 3rd level of JSON with Angular ng-repeat
  • Slicing an SPA into several components and use AngularJS
  • to implement a spinner in angular2+
  • How to get links to open in the native browser in iOS Meteor apps?
  • Angular2 component view does not update on value change via method
  • CakePHP ACL tutorial initDB function warnings
  • gspread or such: help me get cell coordinates (not value)
  • How to attach a node.js readable stream to a Sendgrid email?
  • Meteor helpers not available in Angular template
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • req.body is undefined - nodejs
  • Modifying destination and filename of gulp-svg-sprite
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Importing jscolor library in angular 2
  • Hazelcast - OperationTimeoutException
  • RestKit - RKRequestDelegate does not exist
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • SetUp method failed while running tests from teamcity
  • Revoking OAuth Access Token Results in 404 Not Found
  • Understanding cpu registers