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 the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to