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.


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 Scope.$eval (
    at Scope.$apply (
    at HTMLElement.<anonymous> (
    at Array.forEach (native)
    at forEach (
    at HTMLElement.eventHandler (
    at triggerMouseEvent ( 

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

Any suggestions?