Customising the API mapping for ng-admin, need a function to change "id" to "_id"


Currently I am using ng-admin to build an admin panel for my webapp.

This link talks about API mapping and the JSON response expected when ng-admin uses a GET request to get data.

The JSON response format is as follows:

  "id": 12,
  "name": "War and Peace",
  "author_id": 345,
  "publication_date": "2014-01-01T00:00:00Z",

for a book entity defined by name, author_id and publication date.

My REST API returns exactly the same except “_id” instead of “id”.

I think this is the reason I can’t retrieve data from my API. How can I solve this issue?


Use the entity identifier() method, as explained in the doc (

var post = nga.entity('posts')

Answered By – François Zaninotto

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.