改变NG重复内部角度UI视图视图、角度、NG、UI

2023-09-13 03:27:59 作者:失于雾.

我是在一个单一的控制器使用多个命名UI的意见。一切工作spected名字时,与该code中的HTML文件中的用户界面视图:

I am using multiple named ui-views in a single controller. Everything is working as spected when name the ui-view in the html file with this code:

<div class="box"> 
  <div ui-view="selector"></div>  

  <div ui-view="widget1"></div>
  <div ui-view="widget2"></div>
  <div ui-view="widget3"></div>
  <div ui-view="widget4"></div>
</div>

但是,当我想动态加载一些与这些看法NG-重复它不更新的信息。

But when I want to load dynamically some of those views with a ng-repeat it does not update the information.

<div class="widgets">
  <div class="widget-container" ng-repeat="widget in widgets">
    <div ui-view="{{widget}}"></div>
  </div>
</div>

我怎么可以加载UI的观点从我的NG-重复?

How could I load ui-views from my ng-repeat?

推荐答案

这还没有得到答复,所以我决定继续前进,并展示如何做到这一点。不幸的是由于某种原因在问题的尝试没有工作,但你可以做的是链接花括号之间的函数,并返回所需的视图的字符串。例如控制器是这样的:

This hadn't been answered so i decided to go ahead and show how to do it. Unfortunately for some reason the attempt in the question didn't work but what you can do is link to a function between curly brackets and return the string of the view you want. For instance the controller would look like this:

$ scope.groups = ['主','案件','模型']; $ scope.pickView =功能(指数){     返回$ scope.groups [指数] };