我怎么称Json wih angular js

时间:2015-05-13 20:48:09

标签: javascript jquery json angularjs

我正在尝试修复我的响应功能。

我认为问题在于我的controller.js,但我可能非常错误:

angular
    .module('OrganisatieApp.controllers', [])
    .controller('organisatieController', function ($scope, organisatieAPIservice) {
        $scope.organisatieList = [];
        organisatieAPIservice.getOrganisaties().success(function (response) {
            //Assign response in Callback
            $scope.organisatieList = response(); // as you can see here there needs something to be added but i really dont know what it could be.
        });
    });

$scope.organisatieList = response(what is in here?);

通常,它会是这样的:

response.MRData.StandingsTable.StandingsLists[0].DriverStandings;

但我不知道那条线上发生了什么。

这是我的 app.js

angular
    .module('OrganisatieApp', [
        'OrganisatieApp.controllers',
        'OrganisatieApp.services'
    ]);

这是我的 services.js

angular
    .module('OrganisatieApp.services', ['ngResource'])
    .factory('organisatieAPIservice', function ($resource) {
        var organisatieAPIservice = [];
        organisatieAPIservice.getOrganisaties = function () {
            return $http({
                method: 'JSONP',
                url: 'http://jbossews-themaopdracht78.rhcloud.com/rest/json/org/Organisaties'
            });
        }
        return organisatieAPIservice;
    });

这是我的html div:

<div class="panel-body">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>#</th>
                <th>Organisatie naam</th>
                <th>Organisatie plaats</th>
                <th>Organisatie Curriculum</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="organisatie in organisatieList">
                <td>{{$index + 1}}</td>
                <td>
                    <img src="/img/logos/{{organisatie.Organisatie.logo}}.png" />
                    {{organisatie.Organisatie.orgNaam}}&nbsp;{{organisatie.Organisatie.orgVolledig}}
                </td>
                <td>{{organisatie.Constructors[0].provincie}}</td>
                <td>{{organisatie.curriculum}}</td>
            </tr>
        </tbody>
    </table>
</div>

我做错了什么以及为什么我无法在表格中获取数据?

0 个答案:

没有答案