javascript - how can prevent remaining table rows from ng-repeat start in nested json? -


property  in homepalgroupprop.properties 

my json data :

property=[{unitname : 1bhk, data:[{}]] }, {unit name : 3bhk},{}] 

like this

{     "unitname": "3 bhk",     "data": [     {         "unitname": "3 bhk+3t",         "property_size": "1521 ",         "bedrooms": 3,         "unit_type_name": "3 bhk",         "unit_type_status": 1,         "unitprice": 6538779,         "price_per_sqft": "4299",         "hp_property_id": 9,         "unit_price_id": 51,         "$$hashkey": "object:65"     },     {         "unitname": "3 bhk+3t",         "property_size": "1523 ",         "bedrooms": 3,         "unit_type_name": "3 bhk",         "unit_type_status": 1,         "unitprice": 6547377,         "price_per_sqft": "4299",         "hp_property_id": 9,         "unit_price_id": 52,         "$$hashkey": "object:66"     },     {         "unitname": "3 bhk+3t",         "property_size": "1525 ",         "bedrooms": 3,         "unit_type_name": "3 bhk",         "unit_type_status": 1,         "unitprice": 6555975,         "price_per_sqft": "4299",         "hp_property_id": 9,         "unit_price_id": 53,         "$$hashkey": "object:67"     },     {         "unitname": "3 bhk+3t",         "property_size": "1526 ",         "bedrooms": 3,         "unit_type_name": "3 bhk",         "unit_type_status": 1,         "unitprice": 6560274,         "price_per_sqft": "4299",         "hp_property_id": 9,         "unit_price_id": 54,         "$$hashkey": "object:68"     }     ],         "$$hashkey": "object:46" } 

my html code :

<tr ng-repeat-start="property in homepalgroupprop.properties" ng-show="project.properties.length>3" ng-click="homepalgroupprop.expanded = !homepalgroupprop.expanded">     <td ng-click="projectlistingcluster(property.data,homepalgroupprop.expanded)">{{property.unitname}}         <span ng-if="!homepalgroupprop.expanded">             <i class="fa fa-chevron-down" aria-hidden="true"></i>         </span></td>     <td><span>{{}}</span></td>     <td><span>{{property.price_per_sqft}}</span></td> </tr>    <tr ng-if="homepalgroupprop.expanded" ng-repeat="prop in currentdata" ng-repeat-end="">      <td>{{prop.unitname}}</td>     <td>{{prop.unitprice}}</td>     <td>{{}}</td> </tr> 

controller code :

 $scope.projectlistingcluster=function (p,ex,$index) {      alert(ex +"..ex");      alert(p+"..p");      $scope.currentdata=p;      alert(json.stringify($scope.currentdata));      alert($index);  } 

i getting loop perfect when clicking on first row 1bhk.its opening rows.so want hide 2 rows(2bhk,3bhk).if clicked on 2 rows can show 2 rows.

enter image description here

enter image description here


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -