Why do I get Lexerr:unterminated quote error?

All we need is an easy explanation of the problem, so here it is.

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

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

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

What am I doing wrong?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

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.

Method 2

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.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply