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)?
specify that it has a parent state by using the "." naming convention. (replace "parentState" with the name of the actual parent): .state('parentState.selectModal',...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With