gpt4 book ai didi

Angularjs:ng-repeat + ng-switch-when != expected

转载 作者:行者123 更新时间:2023-12-03 08:10:00 25 4
gpt4 key购买 nike

以下代码似乎无法正常工作:

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

{{solution.title}} 的输出字面意思是 {{solution.title}}。它不会被 Angular 处理。

最佳答案

ng-switch-when 标签需要一个常量,你不能在里面放一个变量。您可以按如下方式修改代码:

<div ng-repeat="solution in solutions">
<div ng-show="current == solution">
{{solution.content}}
</div>
</div>

关于Angularjs:ng-repeat + ng-switch-when != expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17442053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com