0

I'm trying to pass the folder name inside my query function.

In my controller, I have:

$scope.people = getResult.query({api: 'person'});

And in my services, I have, so far:

.factory('getResult', function($resource) {

  var getResult = $resource('api/:path/:method/:id', {}, {
      query: {method:'GET', params: {path:'@api', method:'get'}, isArray:true },
      save: {method:'POST', params: {method:'save'} },
      get: {method:'GET', params: {method:'edit'} },
      remove: {method:'DELETE', params: {method:'remove'} }
    });

    return getResult;

});

The URL I'm getting is http://localhost/project/api/get?api=person but what I need is http://localhost/coral/api/person/get

I'm a newbie to Angular. What is the right way to do this, and why this is happening?

1 Answer 1

1
var getResult = $resource('api/:path/:method/:id',{path:'@api'}, {
    query: {method:'GET', params: {method:'get'}, isArray:true },
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.