Unable to read data from Array

0

I'm having problems in the code below not being able to read the value $ scope.ids [i] .id, follows code:

$scope.carregarEnderecos = function (id) {
    $scope.repeateEnderecos = [];
    $http.post(url_sistema + 'estabelecimento/listar_enderecos', {'id': id}).success(function (data, status, headers, config) {
        if (data !== '0') {
            $scope.repeateEnderecos = data;
            $scope.ids = [];
            for (var i = 0; i < data.length; i++){
                $scope.ids.push({'id':data[i].local_id});
            console.log($scope.ids);
            }
            $timeout(function () {
                $scope.telefonesEnderecos();
            }, 5000);
            $scope.existeendereco = true;
        } else {
            $scope.repeateEnderecos = 0;
            $scope.existeendereco = false;
        }
    }).error(function (data, status) { // called asynchronously if an error occurs
        alert(data);
    });
};

$scope.telefonesEnderecos = function () {
    $http.post(url_sistema + 'estabelecimento/telefones').success(function (data, status, headers, config) {
        if (data !== '0') {
            $scope.telefones_enderecos = data;


            for (var i = 0; i < data.length; i++)
            var tel = $scope.telefones_enderecos[i].fk_local_empresa;
             if ($scope.ids[i].id === tel) {
                console.log("deu");
            } else {
                console.log("nao deudeu");
            }
        }
    }).error(function (data, status) { // called asynchronously if an error occurs
        alert(data);
    });
};
    
asked by anonymous 02.02.2016 / 12:04

0 answers