如何在modalInstance angularJS内部使用resolve

时间:2019-01-22 13:13:22

标签: javascript angularjs

这是我在serviceController中的代码:

$scope.open = function (categorieId,referenceId) {
  console.log('opening pop upppppp');

  var modalInstance = $uibModal.open({
    templateUrl: 'app/main/service/references/references.html',
    controller: 'ReferencesController',
    windowClass: 'app-modal-window',
    resolve: {
        categorieId: function () {
        return $scope.categorieId;
       //this.categorieId = categorieId;



      },
      referenceId: function () {
        return $scope.referenceId;
        //this.referenceId = referenceId;

      }

    }

这是我在ReferenceController中的代码

function ReferencesController($scope,$http,$uibModalInstance,categorieId,referenceId)
{
    console.log("categorie id",categorieId)
  var vm = this;
  var localPath = "http://localhost:8181/tre";
  var locPath =   "http://127.0.0.1:8085/tre";
  var serverPath = "http://65.99.241.135:8080/tre";

    $scope.idCat = categorieId;
    $scope.idRef = referenceId;
    console.log('aaaa '+ categorieId);

    var config = { params: {idCat :categorieId}}

    function all()
    {
         $http.get(locPath+'/categorie/getImagesRefs?idCat='+categorieId)
        .success(function (data) {
         $scope.categorie=data;


    });
    }
     all();
    $scope.close = function () {

      $uibModalInstance.dismiss('cancel');
    }

}

所以,问题是未定义的categoriId和referenceId也未定义!我需要你的帮助 我该如何测试categoryId的值

0 个答案:

没有答案