Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Remove the Date conversion magic in fromJson #202

Closed
IgorMinar opened this issue Dec 22, 2010 · 0 comments
Closed

Remove the Date conversion magic in fromJson #202

IgorMinar opened this issue Dec 22, 2010 · 0 comments

Comments

@IgorMinar
Copy link
Contributor

doing an automagical conversion of date iso strings in json to date objects results in 10%-20% perf penalty and is often unwanted. It would be better to provide a way to register transformation functions on $resource instances, so that users can opt-in to conversions like this one.

IgorMinar added a commit to IgorMinar/angular.js that referenced this issue Mar 28, 2012
Breaks angular.fromJson which doesn't deserialize date strings into date objects.

This was done to make fromJson compatible with JSON.parse.

If you do require the old behavior - if at all neeeded then because of
json deserialization of XHR responses - then please create a custom
$http transform:

$httpProvider.defaults.transformResponse.push(function(data) {
  // recursively parse dates from data object here
  // see code removed in this diff for hints
});

Closes angular#202
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant