【发布时间】:2014-11-10 04:34:02
【问题描述】:
我正在尝试在我的应用程序中使用 ng-switch。
In Routing configuration :
when('/Test/:TestName/formEditor/:openedFrom', {
templateUrl: 'Testing.html',
controller: 'TestCtrl'
})
在我的 HTML 中
<div ng-switch="openedFrom">
<ul class="breadcrumb" ng-switch-when="fromTab1">
<li><a href="#/solutions" id="act_
</ul>
<ul class="breadcrumb" ng-switch-when="fromTab2" >
<li><a href="#/abc">Visitors</a></li>
</ul>
</div>
我通过 Openedfrom 的方式是
<a class="btn btn-primary" href="#/Test/{{TestName}}/formEditor/fromTab1">Tab 1</a>
<a class="btn btn-primary" href="#/Test/{{TestName}}/formEditor/fromTab2">Tab 2</a>
根本不渲染面包屑。 一旦我删除 ng-switch 一切似乎都可以正常工作。有人可以建议吗?
【问题讨论】:
-
您是否将您的openedFrom附加到范围?比如控制器中的
$scope.openedFrom = $routeParams.openedFrom
标签: angularjs-directive ng-switch