2016-03-30 80 views
0

當我在模式關閉後觸發重新加載回調函數時,列表未更新。重新加載回調不起作用

// Inside my view 
<div tasty-table 
      bind-resource-callback="showStudents.loadAllStudentsRecords" 
      bind-init="showStudents.init" 
      bind-reload="reloadCallback" 

// Inside my controller 
... 
Other implementations here 
... 
vm.reloadCallback = function() { alert("Called"); }; 

vm.delete = function (studId) { 

     // Show modal 
     var modalInstance = $uibModal.open({ 
      templateUrl: 'AppScripts/Views/Student/DeleteStudent.html', 
      controller: 'DeleteStudentCtrl as deleteStudent', 
      backdrop : 'static', 
      keyboard : false, 
      resolve: { 
       studentId: function() { 
        return studId; 
       } 
      } 
     }); 

     modalInstance.result.then(function (status) { 
      if (status === 'ok') 
      { 
       vm.reloadCallback(); 
      } 
     }); 

當我調用reloadCallback功能,但使用「控制器」語法不更新列表 順便說IM被執行的警報。

+0

var app = angular.module('plunker', ['ngAnimate','ui.bootstrap']); app.controller('MainCtrl', function($scope, $uibModal) { $scope.name = 'World'; $scope.studentId = "123" $scope.reloadCallback = function(){ alert("Call back") } $scope.showModal = function(){ var modalInstance = $uibModal.open({ templateUrl: 'deletestudent.html', controller: 'DeleteStudentCtrl as deleteStudent', backdrop : 'static', keyboard : false, resolve: { studentId: function() { return $scope.studentId; } } }); modalInstance.result.then(function (status) { if (status === 'ok'){ $scope.reloadCallback(); } }); } }); app.controller('DeleteStudentCtrl', function($scope, $uibModalInstance, studentId) { console.log(studentId); $scope.closeMe = function(){ $uibModalInstance.close('ok'); } }) 

文檔是否有你已經嘗試過? –

+0

@Sherlock你有沒有解決這個問題的方法?我遇到同樣的問題,無法找到解決方案。 –

+0

@UmakantaBehera nope。我改變了實現,以重定向我的過程到另一個頁面 – Sherlock

回答

相關問題