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

Support resolve method for Modal controllers #1845

Closed
ryanray opened this issue Aug 27, 2015 · 2 comments
Closed

Support resolve method for Modal controllers #1845

ryanray opened this issue Aug 27, 2015 · 2 comments
Labels

Comments

@ryanray
Copy link
Contributor

ryanray commented Aug 27, 2015

I didn't see anything mentioned in the docs about this so sorry if it is already supported... Now that #728 has been resolved(which is awesome btw!) it would be nice to be able to specify a resolve property for the controller. Similar to how ui-router functions...

$modal({
  controllerAs: 'myCtrl',
  controller: 'MyCtrl',
  resolve: {
    dependency: function() {
      return data;
    }
  }
});

Without this there are only two ways to pass data into the controller that I can see. 1. attach things to the scope 2. inline the controller function so it has access to the same context as the function instantiating the modal.

I don't like #1 because we are trying to avoid attaching things $scope whenever possible. #2 is not great because it makes it ugly to test the controller. We typically put our controllers, services, etc. in their own file and require them in as needed - it would be nice to be able to test the controller in isolation.

ryanray added a commit to zanebenefits/angular-strap that referenced this issue Sep 8, 2015
@ryanray
Copy link
Contributor Author

ryanray commented Sep 8, 2015

Turns out this is already supported. Created a PR to update the docs.

@mgcrea mgcrea closed this as completed in 4655109 Sep 14, 2015
@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.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant