U-router ng-repeat with dynamic named views

I want to dynamically load views into an accordion with ui-router. The thing is, when I generate views by name inside ng-repeat, I cannot load views at all.

I know that someone else asked about this question , but there was no solution.

Is this even possible?

 <div class="panel panel-default" data-ng-repeat="group in groups">
   <div data-ui-view="step{{ group.number }}"></div>
 </div>

Edit:

.config(function($stateProvider, $urlRouterProvider){

    $urlRouterProvider.otherwise("/index1/id");//

    $stateProvider

        .state("index1", {
            abstract:true,
            url: "/index1",
            template: "<h1>This is index 1 abstract</h1><div ui-view></div>"
        })
        .state("index1.id", {
            url: "/id",
            template: "<h1>This is index1.id</h1>",
            controller: function($scope,$state){


            }
        })
        .state("index2", {
            abstract:true,
            url: "/index2",
            template: "<h1>This is index 2</h1><div ui-view></div>"
        })
        .state("index2.id", {
            url: "/id",
            template: "<h1>This is index 2.id</h1>" ,
            controller: function($scope,$state){


            }
        });
})

Edit: I created a fiddle . I tried loading the named view after the repeater completes, but it just doesn't work. I just need a little help to get started with this.

+4
source share

Source: https://habr.com/ru/post/1540004/


All Articles