title: Can I use md-select in angular materials to run a function?
body: <p>I'm running into a strange error but maybe I am using md-select incorrectly. I am trying to go to a new page or sign out based on the ng-selected option. Unfortunately, I am receiving this error:</p>
  
  <pre><code>Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;md-select placeholder="DISRUPTIVE" ng-model="activePage" ng-change="changeSelected()"&gt;
     &lt;md-option value="settings"&gt;Settings&lt;/md-option&gt;
     &lt;md-option value="logout"&gt;Sign Out&lt;/md-option&gt;
   &lt;/md-select&gt;
  </code></pre>
  
  <p>controller: </p>
  
  <pre><code>$scope.changeSelected = function(){
        switch ($scope.activePage) {
        case "settings":
          $location.path( '/account');
          break;
        case "logout":
          $scope.logout();
          break;
      }
  
      };
  </code></pre>
  
  <p>After navigating to the selected page or logging out I receive the error. Can md-select not be used this way?</p>
  
  <p>Edit: It's somehow related to leaving the page without letting md-select finish. If I add a $timeout it works. It's not ideal but at least I can move forward: </p>
  
  <pre><code>$scope.changeSelected = function(){
        $timeout(function() {
          switch ($scope.activePage) {
          case "settings":
            $location.path( '/account');
            break;
          case "logout":
            Auth.logout();
            break;
        }
      }, 1000);
  </code></pre>