Himmators
Himmators

Reputation: 15016

Why do I get Lexerr:unterminated quote error?

I have the following template:

<!--Votez pour ce concept de bar:-->
<p ng-show="enabled('http://ballentines.herokuapp.com/{{finalist.slug}}.html') === 'novote'">Not voted</p>

<!-- Vous avez voté pour ce concept de bar-->
<p ng-show="enabled('http://ballentines.herokuapp.com/{{finalist.slug}}.html') === 'thisvote'">
    Voted for this concept
</p>

<!--Vous ne pouvez voter que pour un seul concept de bar -->
<p ng-show="enabled('http://ballentines.herokuapp.com/{{finalist.slug}}.html') === 'othervote'">
    Voted for another concept
</p>

When I try to run it, I get

Error: [$parse:lexerr] Lexer Error: Unterminated quote at columns 8-57 ['http://ballentines.herokuapp.com/{{finalist.slug] in expression [enabled('http://ballentines.herokuapp.com/{{finalist.slug].
http://errors.angularjs.org/1.2.11/$parse/lexerr?p0=Unterminated%20quote&p1=s%208-57%20%5B'http%3A%2F%2Fballentines.herokuapp.com%2F%7B%7Bfinalist.slug%5D&p2=enabled('http%3A%2F%2Fballentines.herokuapp.com%2F%7B%7Bfinalist.slug

What am I doing wrong?

Upvotes: 12

Views: 20651

Answers (2)

Eugene Gluhotorenko
Eugene Gluhotorenko

Reputation: 3164

ng-show expects expression while {{ }} is just shortcut for ng-bind directive. In your case

<p ng-show="enabled('http://ballentines.herokuapp.com/' + finalist.slug + '.html') === 'novote'">Not voted</p>

should work.

Upvotes: 3

BradGreens
BradGreens

Reputation: 1377

I get this error from time to time when Chrome's Angular Batarang extension is installed. It auto updates itself and sometimes the error is present, sometimes not.

To test this, I just disable Batarang and refresh the app.

Upvotes: 5

Related Questions