Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript angularjs数据不一致_Javascript_Arrays_Angularjs_Angularjs Scope - Fatal编程技术网

Javascript angularjs数据不一致

Javascript angularjs数据不一致,javascript,arrays,angularjs,angularjs-scope,Javascript,Arrays,Angularjs,Angularjs Scope,我试图在指令中使用父作用域中的值,但看起来我在处理量子物理领域:如果我从作用域中查看我想要的内容,它似乎消失了 console.log($scope.bundle); // array console.log($scope.bundle[0]); // [] (empty array.. should not be) window.test = $scope.bundle; in console: test[0]; //{...} //has content 您的指令是否具

我试图在指令中使用父作用域中的值,但看起来我在处理量子物理领域:如果我从作用域中查看我想要的内容,它似乎消失了

console.log($scope.bundle); // array

console.log($scope.bundle[0]); // [] (empty array.. should not be)

window.test = $scope.bundle;
in console: test[0];         //{...} //has content

您的指令是否具有独立的作用域?我相信Chrome调试器控制台会在“数组”数据展开时向您显示,而不是在使用console.log()输出时显示。您确定您在尝试访问数据时确实有数据吗?你能提供更多的上下文和/或插页吗?我相信根据提供的代码示例无法帮助您。看起来,
$scope.bundle
是异步填充的。。。但如果不看代码,我们就无法准确判断