0

Hi I am having the below in my factory

var MyResource = function($resource){
var MyResources  =  $resource('/test/rest/tests/activities/:userId',
  {
    userId: '@userId'
  },
  {
     query: {isArray: false}
  }
  );
  return MyResources ;
};

And I am calling the method like

MyResource.get({userid:$stateParams.userId})
    .$promise.then(function(data) {
            $scope.week1 = data.total1;
            $scope.total1 = data.totalAll1;
            monthArray = data.tasksMonth;
            console.log(monthArray);
            init();
  });

If the value of $stateParams.userId is testUser, I want the url like below

/test/rest/tests/activities/testUser

But now am getting a url like below

/test/rest/tests/activities?userId=testUser
1
  • 1
    This is javascript not java. Commented Apr 21, 2015 at 13:58

1 Answer 1

2

The objects in Javascript are case sensitive, your are using:

MyResource.get({userid:$stateParams.userId})

Instead of :

MyResource.get({userId:$stateParams.userId})

Where the userId change from userid to userId (I is in uppercase)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.