当我点击链接<< Add Call >>
时,使用自定义URL打开模态,但在后台是空白视图,我希望之前的状态在打开时仍然出现在模态后面
<li><a ui-sref="new-call">Add Call</a></li>
.state('new-call', {
url: '/new-call',
resolve: {
PreviousState: [
"$state",
function ($state) {
var currentStateData = {
Name: $state.current.name,
Params: $state.params,
URL: $state.href($state.current.name, $state.params)
};
return currentStateData;
}
]
},
onEnter: ['PreviousState', '$stateParams', '$state', '$modal', '$location',
function(PreviousState, $stateParams, $state, $modal, $location){
$modal.open({
templateUrl: 'views/new-call.html',
controller: 'NewCallCtrl'
}).result.finally(function(){
$state.go(PreviousState.Name, PreviousState.Params);
});
console.log($stateParams);
}]
})
答案 0 :(得分:0)
我建议,让 'new-call'
成为所有 'calls'
的孩子
.state('calls', {
url: '/calls',
...
.state('calls.new-call', {
url: '/new-call',
...
现在,如果用户要创建新的呼叫,他将已经处于状态'呼叫' - 这样,它的视图将不会消失,只是模态将被打开...