I'm trying to use ui-router to trigger a modal for a certain state, rather than changing the entire view. To do this, I implemented a slightly adapted form of what is given in the FAQ, as I'm using angular-foundation rather than bootstrap. When I trigger the state, the modal is shown, however it also clears out the existing views even though no views are specified in my state:
.state('selectModal',
onEnter: ($modal, $state, $sessionStorage) ->
$modal.open(
templateUrl: 'views/select_modal.html'
windowClass: 'tiny'
controller: 'SelectCtrl'
resolve:
options: (Restangular) -> Restangular.all('options').getList()
)
.result.then (result) ->
$sessionStorage.selected = result
$state.go 'resource', id: result.id
)
Should I be configuring views/parents for this state e.g. <div ui-view='modal'></div>
or parent:'main'
(I'd like it to be accessible from any state without changing that state when toggled)?
.state("items.add", {})
, so when you triggeritems.add
state,items
won't be changed. In your case you trigger state without parent, so you should use github.com/angular-ui/ui-router/wiki/Multiple-Named-Views – Buoyancyconstant
values – Buoyancy