Format all model & service URLs to include .json in Angular JS

I'm having a problem where my web service expects all RESTful urls to include a .json extension on the URL. I've made it so in my Angular code so that all URLs have that extension. So my service urls look like this:

/resources/:id.json

But the problem is that when I include the .json extension then the POST create restful action ends up posting to a URL that looks like:

/resources/.json

This throws an error.

What I need to do is set the defaults inside my AngularJS app to set .json just before each URL is returned. Any ideas on how to do this?

I don't think so.

You could edit your copy of angular-resource.js to have this. Accept a suffix parameter in your resource or something.

Since this doesn't exist (yet) in AngularJS I had to fork a repo and add it myself.

Here's the repo with this feature added.

https://github.com/yearofmoo/angular.js