AngularJS 范围 return $$州

AngularJS scope return $$state

我有一个指令,在这个指令中我有一个来自我的控制器的值,这是我的指令:

angular
  .module('thermofluor')
  .directive('tablePlate', tablePlate)


tablePlate.$inject = ['$timeout', '$q'];

function tablePlate($timeout, $q) {
  var directive = {
    link: link,
    restrict: 'E',
    templateUrl: '/crims/thermofluor/experiments/table_plate.html',
    scope: {
      plate: '='
    }
  };

  return directive;

  function link(scope, element) {
    console.log("test");
    var plate = scope.plate;
    console.log(plate);
    scope.letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
    scope.numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

    experiments = [];
    experiments[scope.plate.experiment.well] = [scope.plate.experiment];

    return;
  }
}

问题是,当我 console.log 范围时,我看到我的板对象里面有我需要的一切,但是当我尝试 console.log scope.plate 对象时,对象改变了它 return 我 $$state,我不知道如何使用这个 $$state

有人有想法吗?

//use of the controller with scope will resolve your problem

angular
    .module('thermofluor')
    .directive('tablePlate', tablePlate)


tablePlate.$inject = ['$timeout', '$q'];

function tablePlate($timeout, $q) {
    var directive = {
        link: link,
        restrict: 'E',
        controller: ['$scope',function($scope){
                console.log("test");
                var plate = $scope.plate;
                console.log(plate);
                $scope.letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
                $scope.numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

                experiments = [];
                experiments[$scope.plate.experiment.well] = [$scope.plate.experiment];

        }],
        templateUrl: '/crims/thermofluor/experiments/table_plate.html',
        scope: {
            plate: '='
        }
    };

    return directive;

    function link(scope, element) {
        return;
    }
}