0

I need one help. I need to put multiple condition inside one ng-if directive using Angular.js but getting the below error.

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)

I am explaining my code below.

 <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>

Here I have to use the AND operator and here This div has two parent index. I need to compare all those. Please help me to resolve this error.

1 Answer 1

7

As far as I can see, you just forgot a closing double quote (") after && $index !=1>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.