Click here to Skip to main content
15,940,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI All,

In my Angular project, I am trying to fill in a grid with data from database. For some reason the grid comes back empty and without any data. I don't know what I am doing wrong. I would highly appreciate if anyone would help.

PS: I was following this tutorial and after days and days of it not working , I decided to tweak the code a little bit. http://jphoward.wordpress.com/2013/01/04/end-to-end-web-app-in-under-an-hour/[^]


Back to my code:
In my Js file I have got this:

JavaScript
var MyApp = angular.module("MyApp", ["ngResource", "ngRoute"]).
    config(['$routeProvider', function ($routeProvider) {
        $routeProvider.when('/', {templateUrl: 'list.html', controller: 'ListCtrl' }).
            otherwise({ redirectTo: '/' });
    }]);


PHP
MyApp.factory('MyApp',['$resource',  function ($resource) {
    return $resource('/MyApp/:id', { id: '@id' }, { update: {
        method: 'PUT' } });
}]);


PHP
MyApp.controller('ListCtrl', ['$scope', '$routeParams', 'myapp', function ($scope, $routeParams, myapp) {
    var app = ds72.get({ id:$routeParams.id });
    $id = app.id;
    $scope.item = MyApp.update({id:$id}, app);
}]);


and this is how I am trying to display the info in my HTML file
XML
<tr ng-repeat="item in items">
            <td>{{item.FirstName}}</td>
            <td>{{item.LastName}}</td>
            <td>{{item.DOB}}</td>
            <td>{{item.Country}}</td>
Is there anything I am missing?
Posted
Comments
[no name] 8-Oct-14 7:58am    
where is items in your controller code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900