Click here to Skip to main content
12,819,248 members (30,007 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Javascript AngularJs
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:

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


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


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
<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 5-Aug-14 4:36am
1Future854
Comments
2irfanshaikh 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)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 5 Aug 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100