Ad

Why Is My Ng-repeat Not Outputting Results

- 1 answer

Why is ng-repeat not outputting results ?

The insert option is working, but there is no output. Please help me to point out the issue

<head>
<script>
    var syntaxFinder = angular.module('syntaxFinder',[]);


    syntaxFinder.controller('syntaxCtrl', function($scope, $http){
        loaddata();
        function loaddata(){
            $http.get('https://sheetsu.com/apis/v1.0/471f7802').success(function(data){
                $scope.autos = data.result;
                $scope.refresh = function() {
                    loaddata();
                };
            });
        }
    });

    syntaxFinder.controller('FormCtrl',function($scope,$http){

    $scope.SendData = function () {
        // use $.param jQuery function to serialize data from JSON 
        var data = $.param({
            applicatie: $scope.applicatie,
            locatie: $scope.locatie,
            beschrijving: $scope.beschrijving,
            code: $scope.code,
            inhoud: $scope.inhoud,         
        });

        var config = {
            headers : {
                'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
            }
        }

        $http.post('https://sheetsu.com/apis/v1.0/471f7802', data, config)
                        .success(function (data, status, headers, config) {
            $scope.PostDataResponse = data;


        })
        .error(function (data, status, header, config) {
            $scope.ResponseDetails = "Data: " + data +
            "<hr />status: " + status +
            "<hr />headers: " + header +
            "<hr />config: " + config;
            });
        };


});
</script>

</head>

<body ng-controller="syntaxCtrl">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <h2>Syntax Finder</h2>

                    <div class="form-group">
                        <label>Zoek op Inhoud: 
                            <input class="form-control" type="text" ng-model="search.inhoud" placeholder="Mysql register" />
                        </label><br/>
                    </div>

                <table class="table table-striped">
                    <tr>
                        <th>Applicatie</th>
                        <th>Locatie</th>
                        <th>Beschrijving</th>
                        <th>Code</th>
                        <th>Inhoud</th>
                    </tr>

                    <!--<tr ng-repeat="auto in autos | filter:search:strict | limitTo:10 ">-->

                    <tr ng-repeat="auto in autos | filter:search:strict | orderBy:'applicatie' ">  
                        <td>{{auto.applicatie}}</td>
                        <td>{{auto.locatie}}</td>
                        <td>{{auto.beschrijving}}</td>
                        <td>{{auto.code}}</td>
                        <td>{{auto.inhoud}}</td>      
                    </tr>
                </table>

                <div class="form-group">
                    <button ng-click="refresh()">Refresh</button>
                </div>
            </div>
        </div>
    </div>
</body>
Ad

Answer

Here is your problem solved. update your js code with this

Here is fiddle

var myApp = angular.module('myApp',[]);

myApp.controller('syntaxCtrl', function($scope, $http){
function loaddata(){
    $http.get('https://sheetsu.com/apis/v1.0/471f7802').success(function(data){
        $scope.autos = data;
    });
}
$scope.refresh = function() {
    loaddata();
};
loaddata();

});
 myApp.controller('FormCtrl',function($scope,$http){

 $scope.SendData = function () {
   // use $.param jQuery function to serialize data from JSON 
    var data = $.param({
        applicatie: $scope.applicatie,
        locatie: $scope.locatie,
        beschrijving: $scope.beschrijving,
        code: $scope.code,
        inhoud: $scope.inhoud,
    });

    var config = {
        headers : {
            'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
        }
    }

    $http.post('https://sheetsu.com/apis/v1.0/471f7802', data, config)
    .success(function (data, status, headers, config) {
        $scope.PostDataResponse = data;
    })
    .error(function (data, status, header, config) {
        $scope.ResponseDetails = "Data: " + data +
            "<hr />status: " + status +
            "<hr />headers: " + header +
            "<hr />config: " + config;
    });
 };
 });
Ad
source: stackoverflow.com
Ad