The following code doesn't seem to work correctly:

<div ng-switch on="current">
    <div ng-repeat="solution in solutions" ng-switch-when="{{solution.title}}">
        {{solution.content}}
    </div>
</div>

The output of {{solution.title}} is literally {{solution.title}}. It doesn't get processed by angular.

有帮助吗?

解决方案

The ng-switch-when tag requires a constant, you can't put a variable in it. You can rework your code as follows:

<div ng-repeat="solution in solutions">
    <div ng-show="current == solution">
        {{solution.content}}
    </div>
</div>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top