gpt4 book ai didi

javascript - 带有动态命名 View 的 ui-router ng-repeat

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:32:48 25 4
gpt4 key购买 nike

我想使用 ui-router 将 View 动态加载到 Accordion 中。问题是,当我在 ng-repeat 中按名称生成 View 时,我根本无法加载 View 。

我知道有人问过类似的问题 question在这里,但没有解决方案。

这可能吗?

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

编辑:

.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){


}
});
})

编辑:我创建了一个 fiddle .我试图在转发器完成后加载一个命名 View ,但它就是行不通。我只需要一点帮助来让我开始做这件事。

最佳答案

ui-router 直到现在才支持内插的 ui-view 名称:https://github.com/christopherthielen/ui-router/commit/81f6a19a432dac9198fd33243855bfd3b4fea8c0

它还没有内置到一个版本中,但您可以下载源代码并构建它。

关于javascript - 带有动态命名 View 的 ui-router ng-repeat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23577244/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com