title: angular ng-if or ng-show responds slow (2second delay?)
body: <p>I'm trying to show or hide a loading indicator on a button when a request is busy. I do that with angular by changing the $scope.loading variable when a request is loading or when it's done loading.</p>
  <pre><code> $scope.login = function(){
       $scope.loading = true;
      apiFactory.getToken()
          .success(function(data){
              
          })
          .error(function(error){
              
          })
           .finally(function(){
                 $timeout(function() {
                   $scope.loading = false;
                 }, 0);
           });
   };
  </code></pre>
  <p>In the frontend:</p>
  <pre><code>&lt;button ng-disabled=&quot;loading&quot; class=&quot;button button-outline button-positive&quot; type=&quot;submit&quot;&gt;
  Log in 
  &lt;span ng-if=&quot;loading&quot; class=&quot;ion-refreshing&quot;&gt;&lt;/span&gt;
  &lt;/button&gt;
  </code></pre>
  <p>This works fine, but the loading icon (ion-refreshing) is shown for about 2 seconds, while the $scope variable is updated immediately. I tried $scope.$apply but that doesn't seem to be what's wrong here, the scope is updated just fine and immediately after the request. It's just the icon that isn't responding quickly enough.</p>