我在代码中出现错误,我不明白为什么会发生。
功能:
function ConfActualController($scope, NotificacionService) {
$scope.configuraciones = [];
$scope.configuraciones = getDataMock();
console.log('Result of $scope.configuraciones:');
console.log($scope.configuraciones);
function getDataMock() {
var dataMock = [];
NotificacionService.getUsers()
.then(function (successResponse) {
dataMock = successResponse;
console.log('Result of successResponse:');
console.log(successResponse);
});
return dataMock;
}}
“ console.log($ scope.configuraciones);”的结果
“ console.log(successResponse);”的结果
什么是错误? 谢谢!