javascript - Recursive iterate by nested objects with angularjs -


here json nested objects not constant nesting level

{     "level": 2,     "title": "subcat_in_cat2",     "url": "subcat_in_cat2_url",     "id": 5,     "parent": {       "level": 1,       "title": "cat2",       "url": "cat2_url",       "id": 2,       "parent": {         "level": 0,         "title": "cat1",         "url": "cat1_url",         "id": 1,         "vertical_order": 0       },       "vertical_order": 0     },     "vertical_order": 0 } 

how iterate objects creating breadcrumbs data this:

<ul class="breadcrumb">     <li><a href="cat1">cat1</a></li>     <li><a href="cat2">cat2</a></li>     <li><a href="subcat_in_cat2_url">subcat_in_cat2</a></li> </ul> 

with angular js, have this, assuming json object stored in $scope.categories:

<ul class="breadcrumb" ng-repeat="cat in categories">    <li><a href="cat.url">{{cat.title}}</a></li> </ul> 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -