Using JSON.stringify can led to circular reference error

When calling getHashKey(), JSON.stringify can led to circular reference error.
I think it's safer to use angular.toJson() as this method does not serialize $$xxx fileds.