That works to... just be aware of for-in and prototype properties.  toJson
uses the hasOwnProperty or similar in converting.


On Fri, Mar 28, 2014 at 7:07 AM, Deeksha Sharma <
[email protected]> wrote:

> Hey Luke Kende,
> thanks for your suggestion  ,I did it by using angular.toJson.
>
> Thank u once again.
>
>
> On Fri, Mar 28, 2014 at 11:39 AM, Luke Kende <[email protected]> wrote:
>
>> Any time you use "for in" you will get every property including prototype
>> methods and properties of an object (arrays are still objects).  To avoid
>> this, use hasOwnProperty:
>>
>>
>> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
>>
>> for (var item in items){
>>     if (items.hasOwnProperty(item) ){
>>         ..... your code here .....
>>     }
>> }
>>
>> On Thursday, March 27, 2014 4:50:46 AM UTC-6, Deeksha Sharma wrote:
>>>
>>>  Hey all,
>>> I am calling a web api from angularjs and iterating the JSON object but
>>> at the time of iteration .It is giving some unexpected  terms like
>>> $get,$update,$remove etc.
>>> How can I resolve this problem.
>>>
>>>
>>> $scope.Customers=customerService.getCustomers($scope.limit,
>>> $scope.offset).$promise.then(function (data) {
>>> alert(data);
>>> for (var index in JSONData[0]) {
>>>                                 alert(index);
>>>                                 if (index != "AddressDetail")
>>>                                 {
>>>                                     row += index + ',';
>>>                                 }
>>>                                 if (index == "AddressDetail") {
>>>                                     for (var indexx in
>>> arrData[0]["AddressDetail"])
>>>                                     {
>>>                                         if (indexx == "addressDetailId")
>>> {
>>>                                             continue;
>>>                                         }
>>>                                         row += indexx + ',';
>>>                                     }
>>>                                 }
>>>                                 //alert(index);
>>>                             }
>>>
>>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/angular/nkTcNKpd9cA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/nkTcNKpd9cA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to