0

I am pretty new to AngularJs, so forgive me for not knowing this. What I am trying to do: I am trying to call an api with a different method name. I have seen a lot about $resource, however i don't understand it.

So the method I am trying to call:

        [Route("api/regions/{id?}"), Authorize]    
        [HttpGet]
        public IEnumerable<Region> GetRegionsByStateId(Guid id)
        {
            var regions = _repository.Get();
            return regions.Where(x => x.StateId == id);
        }

I have tried $http.get('api/regions/'+stateId) which doesnt work, can someone either explain the $resource a little better to me ot tell me why this doesnt work.

1 Answer 1

1

try this

    [Route("api/regions/{id}"), Authorize]
    [HttpGet]
    public IEnumerable<Region> GetRegionsByStateId(Guid id)
    {
        var regions = _repository.Get();
        return regions.Where(x => x.StateId == id);
    }
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.