I'm trying fetch data by calling Java REST service from AngularJS web 
portal. I'm using ngResource. 

*Call From Angular Service :*

    app.factory('UserFactory', function ($resource) {
        return $resource('http://localhost:8080/demoApp/service/users', {}, 
{
            show: { method: 'GET', isArray: true },
            update: { method: 'PUT', params: {id: '@id'} },
            delete: { method: 'DELETE', params: {id: '@id'} }
        })
    });

*Angular Controller :*

function userListController($scope, UserFactory){    
    $scope.showUser = function () {
        $scope.fetchedData = [];        
        $scope.users = UserFactory.show();
        $scope.fetchedData.push($scope.users);        
    };

It is calling Java Service perfectly (As my debugger shows) but NO OUTPUT 
returned at Angular side. 
Even I can get the result if I put the URL directly at the browser :
   
    URL :   http://localhost:8080/demoApp/service/users
    RESULT :   [{"id":1,"firstName":"Jayanta","lastName":"Pramanik"}]

But in Angular-JS controller I can not get any result !!

For your understanding -
Here is my Java REST Service method definition -
     
       @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<User> getAllUsersInJSON() {
 /* ------ Some Hard coded values are set into an ArrayList ------*/
            List<User> userList = new ArrayList<User>();
    User usr1 = new User();
    usr1.setId(1);
    usr1.setFirstName("Jayanta");
    usr1.setLastName("Pramanik");
            userList.add(usr1);
            return userList;
    } 



Any idea please !

Thanks in advance -

*Jayanta P.*
Kolkata,  India. 


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to