重新加载回调无效

时间:2016-03-30 05:00:13

标签: angularjs

当我在模态关闭后触发重载回调函数时,列表没有更新。

 // 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函数但未更新列表时执行了警报 顺便说一下我使用&#34;控制器作为&#34;语法。

1 个答案:

答案 0 :(得分:1)

由于代码不完整,我无法理解您使用哪种方法关闭模态窗口。在这里检查Plunkr的工作情况。希望它能解决你的问题。 https://plnkr.co/edit/LnV021AjBXhamG8ygLp1?p=preview

@Override
protected void onHandleIntent(Intent intent) {

         //This is where you will put your volley code or some code that you want to perform in background
}

模态https://github.com/angular-ui/bootstrap/tree/master/src/modal/docs

的文档