Search code examples
angularjsangularjs-scope

Angular dynamically change ng-repeat name


I have ng-repeat in my html. how I can add ng-repeat with dynamically changes name.

<div ng-repeat="category in categories"> //external repeat

<div ng-repeat="data in categoryData.{{categoryName here}}"> 

// want add instead .{{categoryName here}} defined (concrete) name from external loop.

In result I want have many places in html and different data for each place that will be places in categoryData.NameOfCategory .NameOfCategory will replaced to concrete name.


Solution

  • You can try this,

    <div ng-repeat="category in categories"> 
    <div ng-repeat="data in categoryData[category.name]">