2016-08-02 3 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(); 
} 

}

followig解決で解決された値を使用するにはどうすればよいですか? (連鎖が解決する)。

答えて

0

このようにすることはできません。ただし、約束を1つの解決ブロックにまとめることができます。

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