我需要一个帮助。我需要使用Angular.js在一个ng-if
指令中放入多个条件,但得到以下错误。
Error: [$parse:syntax] Syntax Error: Token '<' not a primary expression at column 87 of the expression [$parent.$parent.$index != 1 && $parent.$index != 0 && $index !=1>
<div class=] starting at [<div class=].
http://errors.angularjs.org/1.4.7/$parse/syntax?p0=%3C&p1=not%20a%20primary%20expression&p2=87&p3=%24parent.%24parent.NaNndex%20!%3D%201%20%26%26%20%24parent.%index%20!%3D%200%20%26%26%20%24index%20!%3D1%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cdiv%class%3D&p4=%3Cdiv%class%3D
at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:68:12
at AST.throwError (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:13057:11)
at AST.primary (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12960:12)
at AST.unary (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12940:19)
at AST.multiplicative (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12927:21)
at AST.additive (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12918:21)
at AST.relational (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12912:90)
at AST.equality (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12903:90)
at AST.logicalAND (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12894:85)
at AST.logicalOR (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js:12884:21)
我正在解释下面的代码。
<div ng-if="$parent.$parent.$index != 1 && $parent.$index != 0 && $index !=1>
<div class="panel-group accordion-content-div accordioninner accordioninner-inner">
<div class="panel panel-default" style="border:1px solid #66afe9;">
<div class="panel-heading">
<a class="panel-title sky-blue-light auditformpopup" role="button" ng-click="getAllNextPreviousIds(cd.sub_sub_id,$index,$parent.$index,$parent.$parent.$index)">
{{cd.des}}
</a>
</div>
</div>
</div>
这里我必须使用AND
运算符,这里这个div有两个父索引。我需要比较所有这些。请帮我解决这个错误。
答案 0 :(得分:7)
据我所知,你刚忘了&& $index !=1>
之后的结束双引号(“)