Call function after delay on page load using Angular
<p>I am trying to call a function in Angular 2.5 seconds after a page loads to see if a form field has been autofilled.  The function is being called but for some reason is only called if I navigate away from the field, change the tab, minimize the browser, etc.  How can I accomplish this without requiring the user to do any of these actions (i.e. it is called 2.5 seconds after page load no matter what).  I have two different implementations I have tried below but they behave the same way.</p>

<p>Method 1:</p>

<pre><code>var timer=false;
$scope.$watch('email', function(){
    if(timer){
         $timeout.cancel(timer)
}
    timer= $timeout(function(){
        $scope.emailChanged();
    }, 250)
});
</code></pre>

<p>Method 2:</p>

<pre><code>&lt;div class="form-managed" ng-init="load()"&gt;&lt;/div&gt;

$scope.load = () =&gt; {
    setTimeout(() =&gt; {
            $scope.emailChanged();
    }, 2500);
 };
</code></pre>

<p>Update: </p>

<p>From comments I changed the code to use $timeout instead of my other implementations.  I also verified that the function is being called in any of the implementations however the value of the field still shows as null when I try to extract it.  Current code below.</p>

<pre><code>$timeout(() =&gt; {
    debugger;
    var thisEmail = document.getElementById("buyerEmail");
    $scope.emailChanged();
}, 5000);
</code></pre>

<p>Input field:</p>

<p><code>&lt;input type="email" class="form-control input-lg" name="email" id="buyerEmail" placeholder="Email address" autocomplete="email" ng-model-options="{updateOn: 'blur'}" ng-change="emailChanged($event)" required /&gt;</code></p>