Mar*_*tov 2 angularjs ng-switch angularjs-ng-repeat
以下代码似乎无法正常工作:
<div ng-switch on="current">
<div ng-repeat="solution in solutions" ng-switch-when="{{solution.title}}">
{{solution.content}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
输出{{solution.title}}是字面上的{{solution.title}}.它不会被角度处理.
ng-switch-when标记需要一个常量,你不能在其中加一个变量.您可以按如下方式重新编写代码:
<div ng-repeat="solution in solutions">
<div ng-show="current == solution">
{{solution.content}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)