Silmarillion
Silmarillion

Reputation: 219

Angular and UIGrid - getting table data

I'm using Angular and uigrid - which is a great library where you can render data in a tabular fashion. I've got it displaying fine. When I update an item in the table and then click a Save button (which I added) I then call a rest service (which sends the table's data to the rest call)

When I do this (in chrome, with chrome tools window open) I can see that my data in my table has some extra stuff in it, i.e. the structure is an array of objects where each object is a row in the table. That's fine - but I'm seeing an extra field in each array element (such as $$hashKey: "uiGrid-00H"). This extra field is breaking my rest call.

Essentially my question is - how do I (in my controller) get the current data in the table (without the extra "stuff" that uigrid seems to add) ?

Any thoughts/advice/guidance would be great. Thanks - Ro

Upvotes: 1

Views: 1133

Answers (1)

user1777136
user1777136

Reputation: 1756

This $$hashKey is added by angular. See also What is the $$hashKey added to my JSON.stringify result.

You can get rid of it by angular.copy(fieldData) or angular.toJson(fieldData).

Upvotes: 1

Related Questions