btford / btford/angular-modal

Resolving variables into modal with ui.router

Open
#13 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
231
Forks
55
PR merge metrics
No merged PRs in 30d

Description

I am trying to use your lib in combination with state resolves of ui-router and my code looks a bit like this:

```
.state({
name: 'main',
url: '/main',
controller: 'InputViewCtrl',
templateUrl: 'tpl/overviewInput.html',
resolve: {
tasks: function(Shared, TaskService){
return TaskService.getTasks(Shared.getMonthParameters())
}
}
})
.state({
name: 'main.addtask',
url: '/addtask',
onEnter: function(modal, tasks){
modal.activate();
},
onExit: function(modal){
modal.deactivate();
},
resolve:{
modal: function(btfModal){
return btfModal({
controller: 'ExternalTaskAddCtrl',
controllerAs: 'modal',
templateUrl: 'tpl/partials/externalTaskAdd.html'
});
}
}
})
```

So as you can see, in my 'main' state I resolve the tasks variable and in my sub-state 'main.addtask' I wish to use this that variable. Now I could easily fix this with:

`modal.activate({tasks : tasks});`

But that loses the dependency injection in my modal and is directly inserted in the scope. Is there a way I can achieve it that looks similar to what the angular ui-bootstrap modal is doing?[1]

[1] https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-open-a-dialogmodal-at-a-certain-state

-edit: link was broken

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.