Encountering a peculiar issue with the md-select element - I may be using it incorrectly. The goal is to redirect to a new page or sign out based on the selected option, but instead, I'm faced with this error:
Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Here is the HTML code:
<md-select placeholder="DISRUPTIVE" ng-model="activePage" ng-change="changeSelected()">
<md-option value="settings">Settings</md-option>
<md-option value="logout">Sign Out</md-option>
</md-select>
And the controller code:
$scope.changeSelected = function(){
switch ($scope.activePage) {
case "settings":
$location.path( '/account');
break;
case "logout":
$scope.logout();
break;
}
};
The error occurs after navigating to the selected page or logging out. Is it possible that md-select cannot be used in this manner?
Update: The issue seems to be related to leaving the page before md-select completes its action. Adding a $timeout resolves the error, albeit not an ideal solution:
$scope.changeSelected = function(){
$timeout(function() {
switch ($scope.activePage) {
case "settings":
$location.path( '/account');
break;
case "logout":
Auth.logout();
break;
}
}, 1000);