angularjs does not bring results

0

I'm trying to bring results from a database but there is a flaw. It does not show any element when operating ng-repeat

ANGULARJS

angular.module('vinApp', [])
  .controller('propDis', function($scope,$http) {
        $http({
              method: 'GET',
              url: '../look.php',
        }).then(function successCallback(response) {
          $scope.propis = response.data;
          alert('response');
        }, function errorCallback(response) {
              console.log('error no response');
              alert('no response');
        });
  });

PHP

<?php 

include('panel/base.php');

$query = mysqli_query($mysqli,"SELECT * FROM props");
if(mysqli_num_rows($query) > 0){
    while($row = mysqli_fetch_assoc($query)){
        $data[] = $row;
    }
} else {
    echo "0 results";
};
echo json_encode($data);

?>

HTML

<div class="props_item" ng-repeat="props in propis">
                <div class="props_item_img">
                    <img src="css/">
                </div>
                <div class="props_item_footer">
                    <div class="props_item_footer_title">
                        {{props.nombre}}
                    </div>
                    <div class="prop_hide_elements">
                        <div class="prop_hide_elements_item">
                            <img src="images/iconos-01.png">
                            <div class="fix">&nbsp;</div>
                            {{props.terreno}}
                        </div>
                        <div class="prop_hide_elements_item">
                            <img src="images/iconos-02.png">
                            <div class="fix">&nbsp;</div>
                            {{props.moneda}} {{props.precio}}
                        </div>
                        <div class="prop_hide_elements_item">
                            <img src="images/iconos-03.png">
                            <div class="fix">&nbsp;</div>
                            {{props.tipo}}
                        </div>
                        <div class="prop_hide_elements_item">
                            <img src="images/iconos-04.png">
                            <div class="fix">&nbsp;</div>
                            {{props.locacion}}
                        </div>
                    </div>
                </div>
            </div>

Ng-app and ng-module are being named above with the same names that are shown in the angularjs file.

    
asked by Isidoro Barrera 26.01.2018 в 16:26
source

1 answer

0

Try this code, maybe, as it works.


angular.module('vinApp', [])
  .controller('propDis', function($scope,$http) {
        $http.get('../look.php').then(function(response) {
           $scope.propis = response.data;
           alert('response');
        }, function(error) {
           console.log('error no response');
           alert('no response');
        });
  });

    
answered by 26.01.2018 в 17:24