2016-08-02 27 views
0

我在工廠使用$ uibModal,我想鏈接解析但我得到post提供程序錯誤。

return { 
openTextEditModal: function(id) { 
    var modalInstance = $uibModal.open({ 
     templateUrl: 'tpl.html', 
     backdrop: 'static', 
     controller: function($scope, $uibModalInstance, $sce, post, user, $http, $stateParams) {}, 
     size: 'lg', 
     resolve: {    
      post: function() { 
       return $q.when('testing'); 
      }, 
      user:function(post){ 
       //do stuff with post 

       return $q.when(userObj); 
      }, 
     } 
    }); 
}, 
close:function(){ 
    $uibModal.close(); 
} 

};

如何在隨後的解決方案中使用已解決的值? (鏈接解析)。

回答

0

你不能這樣做。但是,您可以在一個解析塊中鏈接承諾:

resolve: { 
    user: function() { 
     return $q.when('testing') 
      .then(function(post) { 
       //do stuff with post 
       return $q.when(userObj);   
      }); 
    }, 
} 
相關問題