根据Angular中的ng-view名称加载div

时间:2018-08-03 13:55:17

标签: angularjs

我有这个div - A

<div class="container">
      <div ng-view="" autoscroll="true">
        <!--ANGULAR-INJECTED CONTENT-->
      </div>
    </div>

div - B

<div class="container-fluid">
      <div ng-view="transactions" autoscroll="true">
    </div>

我要加载div - B if ng-view="transactions ",否则要加载div-A

我该怎么做?

1 个答案:

答案 0 :(得分:1)

为什么不使用ng-switch? 试试这个:

<div ng-switch on="transactions">
      <div class="container-fluid" ng-switch-when="value1"><div autoscroll="true" /></div>
      <div class="container" ng-switch-default><div autoscroll="true"><!--ANGULAR-INJECTED CONTENT--></div></div>
</div>