Here is my current code:
Parent Controller
vm.animationsEnabled = true;
vm.open = function (size) {
var modalInstance = $uibModal.open({
animation: vm.animationsEnabled,
templateUrl: 'app/entities/interview-stage/interview-stage-list-add-dialog.html',
controller: 'InterviewStageListAddDialogController',
controllerAs: 'vm',
size: 'cs',
});
modalInstance.result.then(function (selectedItem) {
vm.interviewPlanSetUp.push(selectedItem);
}, function () {
//$log.info('Modal dismissed at: ' + new Date());
});
};
Modal Controller
Nothing major going on: I am selecting a value and passing back the result to the parent controller
function save () {
vm.selectedStage.rounds=vm.selectedRound;
$uibModalInstance.close(vm.selectedStage);
$scope.$emit('gorecruitApp:interviewStageUpdate', 'test');
}
This is working fine.
However when I am trying to do this through UI -Router I am not able to access "Parent Scope"
I am doing the following
.state('interview-stage.addStage',{
parent:'job-setup.new',
url:'/addStage',
data:{
authorities: ['ROLE_USER']
},
onEnter:['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
$uibModal.open({
templateUrl: 'app/entities/interview-stage/interview-stage-list-add-dialog.html',
controller: 'InterviewStageListAddDialogController',
controllerAs: 'modal',
scope: $scope,
backdrop: 'static',
size: 'cs',
resolve: {
// entity: ['InterviewStage', function(InterviewStage) {
// return InterviewStage.get({id : $stateParams.id}).$promise;
// }]
}
}).result.then(function() {
$state.go('job-setup.new', null, { reload: 'job-setup.new' });
}, function() {
$state.go('^');
});
}]
})
Parent Controller is the controller attached to job-setup.new which is the parent of interviewstage.addStage
I have tried few suggestions. Nothing worked so far. Any pointers?
EDIT: Here is a plunker: https://plnkr.co/edit/HJT1f1C23s2HQ2jTcy9p?p=preview
Here the data returned from modal should appear in "partial-home.html"