【发布时间】:2017-06-20 15:31:26
【问题描述】:
我有一个显示多个图标的循环 ng-repeat。
<div class="box">
<div class="box-body">
<div class="row" >
<div class="col-sm-6" style="margin-bottom: 5px;" ng-repeat="record in newlayout.display" align="center">
<a class="btn btn-app" ng-href="#newlayout/{{newlayout.url}}{{newlayout.itemValue}}" >
<span class="badge bg-yellow" style="font-size:22px;">{{record.numberOfSamples}}</span>
<i class="fa fa-{{newlayout.labStyle}}"></i> {{record.lab}}
</a>
</div>
</div>
</div>
</div>
我的问题是绑定变量 itemValue 的第二部分应该是动态的
在我的 Js 中,我有这个
newLayout.url = 'sublabs/?labName=';
newLayout.itemValue = 'record.lab';
网址是动态的。 当我点击第一个显示的图标时,网址应如下所示:
但它没有工作,因为我有一个编译错误..
有人知道如何解决这个问题吗:
http://localhost:8181/#/newlayout/sublabs?labName=PIA/C1 - Shiftlabo
记录值“PIA/C1 - Shiftlabo”变化的地方。
如果我改变,基本上就在这里
<a class="btn btn-app" ng-href="#newlayout/{{newlayout.url}}{{newlayout.itemValue}}" >
{{newlayout.itemValue}} by {{record.lab}} 它会起作用..但是{{record.**lab**}} 应该是动态的,因为当我单击图标时它将具有另一个值。它将更改为{{record.subLab}}
谢谢
【问题讨论】:
-
编译错误是什么?
-
你好 Jonnysai 。编译显示为 intelli "jError: $parse:syntax Syntax Error Syntax Error: Token '{' is not a valid at column {2} of the expression [{3}] 从 [{4}] 开始。
-
你能发一个记录的例子吗
-
“绑定变量 itemValue 的第二部分应该是动态的”我无法理解可能是发布您的记录和 ng-repeat
-
LLai,Jonnysai 我已经编辑了我的帖子