Angularjs 得到';未定义';使用$scope.$parent时,但它有数据

Angularjs 得到';未定义';使用$scope.$parent时,但它有数据,angularjs,Angularjs,我正在尝试访问$scope.$parent中的数据。在尝试访问时,我总是未定义,$scope.$parent的日志中有数据 比如说, app.controller('ParentCtrl', function($scope){ $scope.parentData = { name : 'Beacon', address : 'Cheese' }; }); app.controller('ChildCtrl', function($scope){

我正在尝试访问$scope.$parent中的数据。在尝试访问时,我总是未定义,$scope.$parent的日志中有数据

比如说,

app.controller('ParentCtrl', function($scope){
    $scope.parentData = {
        name : 'Beacon',
        address : 'Cheese'
    };
});

app.controller('ChildCtrl', function($scope){
    console.log($scope.$parent); // There is parentData in log
    console.log($scope.$parent.parentData); // it show 'undefined'
});
我不明白我做错了什么。非常感谢你的帮助

编辑 这是console.log($scope.$parent)的屏幕截图;

我可以看到console.log的输出,如下所示

console.log($scope.$parent); 
Object { $id: "004", this: Object, $$listeners: Object, $$listenerCount: Object, $parent: Object, $$childTail: Object, $$childHead: Object, $$nextSibling: null, $$watchers: null, $$prevSibling: null, 1 more… } index.html:16:4


console.log($scope.$parent.parentData); 
 Object { name: "Beacon", address: "Cheese" }

请将HTMl粘贴到包含控制器的位置。

能否显示
console.log($scope.$parent)的输出?@Manwal我在帖子中添加了它。您是否尝试使用控制器“as”符号而不是使用$parent?