Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature: pass a callback to a state when navigating to it #1640
Comments
|
Controllers are really intended to be thin layers that bind business objects to UI. If you're trying to compose a specific UI flow, you're better off creating a separate service to handle the navigation that's callable from your controller, and can return a promise that resolves to the selected (or created) widget. We use promises across the board for async control flow, so introducing callbacks would be a pretty big inconsistency. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use Case
I have a
widgetsresource, with a state to create and edit them. This state may be navigated to from multiple contexts, one of which is acampaign-createstate. When creating a campaign, the user must either (a) select a widget, or (b) create one. If the user elects to create one, they are navigated towidget-create.On successful creation, the new widget must be added to a local storage bucket used by
campaign-create, and then navigated back tocampaign-create. These are very much the concerns of thecampaign-createcontroller, and it would be best implemented there.If I had callbacks at my disposal, I could do something like this