javascript - scope variable change after refresh -
in parent view request json file , put in $scope.data. in child view can access without problem , $scope.data.length gives me correct number of items.in console can see json file , start directly [resource { name="alex...
if refresh page, or try access child view directly, $scope.data.length return '0' still can see json file in $scope.data. it's strange, in console don't see before anymore, looks different
console.log($scope.data.length); console.log($scope.data);
for(var i=0; i<$scope.data.length; i++) { if($scope.data[i].id) == $scope.id) { selected=$scope.data[i]; console.log("id found: "+ $scope.id); } } if refresh page, scope.lenght return 0 in both cases can see json file
Comments
Post a Comment