Problem re-displaying modal

I’m getting an error message when trying to re-display a hidden modal. It is actually the login modal that was included with the menu-based scaffold. I have added some code that makes a REST call to authenticate the user. All of that works.

$scope.doLogin = function() {
// AJAX call here	
}

After successful login, I hide the login modal.

$scope.modal.hide();

But if I attempt to show the login modal again, the following error is generated on the console.

TypeError: object is not a function
    at http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:18521:15
    at http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:42067:9
    at Scope.$eval (http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:20382:28)
    at Scope.$apply (http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:20480:23)
    at HTMLElement.<anonymous> (http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:42066:13)
    at http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:10674:10
    at Array.forEach (native)
    at forEach (http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:8184:11)
    at HTMLElement.eventHandler (http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:10673:5)
    at triggerMouseEvent (http://192.168.0.14:8100/lib/ionic/js/ionic.bundle.js:2635:7) 

If I remove the code that performs the login, then the login modal can be hidden and shown without an issue.

Any suggestions?