Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

$scope issue with $modal on route change. #1394

Closed
HimanshuSojitra opened this issue Jan 2, 2015 · 2 comments
Closed

$scope issue with $modal on route change. #1394

HimanshuSojitra opened this issue Jan 2, 2015 · 2 comments

Comments

@HimanshuSojitra
Copy link

I display modal dialogs from controllers like this -

myModal = $modal({
    scope: $scope,
    template: 'template.html',
    show: false,
    backdrop: "static",
    keyboard: false,
    persist: true
});
myModal.$promise.then(myModal.show); 

The issue is that it breaks on route change.

Consider template.html with content:

1 + 1 = {{ 1 + 1 }}

When I open the modal from insida a controller for a route say /screen1,
it displays 1 + 1 = 2.

But now if I close the modal and go to some other route say /screen2
and click browser's back button to again go to /screen1 and on reopen the modal, it displays
1 + 1 = {{ 1 + 1 }}

I don't know why the scope gets detached on the second occasion.(I don't see any JS errors.)

Thanks in advance.

@HimanshuSojitra HimanshuSojitra changed the title $scope detaches from $modal after route change. $scope issue with $modal on route change. Jan 6, 2015
@mgcrea mgcrea closed this as completed in 8e54db8 Jul 12, 2015
mgcrea added a commit that referenced this issue Jul 12, 2015
…or `controller`, `controllerAs`, `template`, `templateUrl` options (fixes #732, fixes #728, fixes #1394, fixes #1735)
mgcrea added a commit that referenced this issue Jul 12, 2015
…or `controller`, `controllerAs`, `template`, `templateUrl` options (fixes #732, fixes #728, fixes #1394, fixes #1735)
@mgcrea
Copy link
Owner

mgcrea commented Jul 12, 2015

Not sure it has properly been fixed, could you try against latest master ?

@lock
Copy link

lock bot commented Jan 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the outdated label Jan 26, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants