title: Angular 9 display number of change detection cycles on the UI? stackblitz inside
body: <p>I'm trying to build a small dev component that displays only in non-production builds. </p>
  
  <p>One of the things that I see useful to keep track of is the number of change detection cycles that I'm triggering as I'm adding various functionality to make sure I'm not doing something that's really unperformant. like having mouseover and mouseout events on the menu icon to change its color.</p>
  
  <p>Sadly I can't seem to get it to actually display on the view and not just in the console. </p>
  
  <p><a href="https://stackblitz.com/edit/angular-4sk7cn" rel="nofollow noreferrer">Stackblitz here.</a></p>
  
  <p>You'll be able to hover over a button that triggers change detection cycles and you can see in your browser console, not the stackblitz console, a counter for how many times that getter is recalculated.</p>
  
  <p>The simplified code to catch the essence of it:</p>
  
  <pre><code>    public changes = 0;
  
      public get changeDetection(): boolean {
          console.count("CHANGES");
          this.changes = +1;
          return true;
      }
  
  </code></pre>
  
  <p>and then in the html template:</p>
  
  <pre><code>&lt;div&gt;{{ changes }}&lt;/div&gt;
  &lt;div&gt;
      {{ changeDetection }}
  &lt;/div&gt;
  </code></pre>
  
  <p>Trying to manually trigger change detection with ChangeDetector ref will result in maximum call stack error. </p>
  
  <p>Trying to switch change detection strategy to Default doesn't make it display either. </p>
  
  <p>I know this is in many ways against desired functionality and requires some backwards work around the framework to get this going -- but I'd still like to give it a shot. </p>
  
  <p>Thanks!</p>