title: Protractor - Where to use browser.waitForAngular()
body: <p>I have some tests written using protractor for angular.js app. I am using <code>Page Objects</code> design pattern and there i have some methods that navigate to other pages by clicking on links and buttons. and soon after that i am calling <code>browser.waitForAngular()</code>.</p>
  
  <p><strong>Page Object</strong></p>
  
  <pre><code>module.exports = function () {
      this.companyNameLink = element(by.id('viewCompany'));
      this.newMeetingButton = element(by.id('newMeetingButton'));
  
      this.createNewGeneralMeeting = function () {
          this.newMeetingButton.click();
          browser.waitForAngular();
      };
  
      this.goToCompanyPage = function () {
          this.companyNameLink.click();
          browser.waitForAngular();
      };
  };
  </code></pre>
  
  <p>And in some spec file i use this page object like this..</p>
  
  <pre><code>var DashboardPage = require('../dashboardPageObject.js');
  dashboardPage = new DashboardPage();
  
  ...
  
  dashboardPage.goToCompanyPage();
  </code></pre>
  
  <p>But the problem is sometimes i get the <code>angular could not be found on the window</code> error and my tests fail. Most of the time the tests run. This issue is random. My question is that should i remove the <code>browser.waitForAngular()</code> from the page object method and call it after i make the method call like this...</p>
  
  <p><strong>Modified Page Object</strong></p>
  
  <pre><code>...
  this.goToCompanyPage = function () {
      this.companyNameLink.click();
  };
  ...
  </code></pre>
  
  <p><strong>Spec File</strong></p>
  
  <pre><code>dashboardPage.goToCompanyPage();
  browser.waitForAngular();
  </code></pre>
  
  <p>Is calling <code>browser.waitForAngular()</code> causing the issue? Where should i call <code>waitForAngular</code> is there any best practice on how to use this?</p>