0

I am working on a Wordpress and Angularjs project on a Linux Mint 17 machine.

I managed to install the project correctly at my development machine at work, and everything worked fine.

However, I just finished installing it on my laptop using git clone from the same repo that I used at work. Everything went apparently fine, but when I try to load a certain page, it doesn't show up correctly. So I take a look at the Chrome Developer Tools console and this is what it says:

Error: [$parse:syntax] http://errors.angularjs.org/1.2.16/$parse/syntax?p0=%3F&p1=not%20a%20primary%20expression&p2=60&p3=%7BlineNumbers%3AshowLn%2C%20mode%3A'plaintext'%2C"<div class="CodeMirror cm-s-default ng-pristine ng-valid" ui-codemirror-opts="{lineNumbers:showLn, mode:'plaintext', onLoad:configEditor<?if(!$can_write):?>"nLoad%3AconfigEditor%3C%3Fif(!%can_write)%3A%3F%3E%2C%20readOnly%3A'nocursor'%3C%3Fendif%3B%3F%3E%7D&p4=%3Fif(!%can_write)%3A%3F%3E%2C%20readOnly%3A'nocursor'%3C%3Fendif%3B%3F%3E%7D
    at Error (native)
    at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:6:450
    at $a.throwError (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:165:141)
    at $a.primary (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:164:330)
    at $a.unary (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:171:73)
    at $a.multiplicative (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:170:310)
    at $a.additive (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:170:170)
    at $a.relational (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:170:34)
    at $a.relational (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:170:111)
    at $a.equality (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js:169:397)

I am very new to Angularjs, so I really don't know what the problem might be or how to debug it.

Also, it is strange that I am using exactly the same code (git clone) that I used at work, where it works fine. So may be I didn't install something correctly? Browser incompatibilities?

I have already installed the Chrome extension Batarang but haven't found it useful (or dind'nt know how to use it properly).

UPDATE: The error seems to be here:

<form class="contenido-evento">
    <textarea ui-codemirror="{lineNumbers:showLn, mode:'plaintext', onLoad:configEditor<?if(!$can_write):?>, readOnly:'nocursor'<?endif;?>}"
              ng-model="evento.texto"></textarea>
</form>

And this is the error message:

Error: [$parse:syntax] Syntax Error: Token '?' not a primary expression at column 60 of the expression [{lineNumbers:showLn, mode:'plaintext', onLoad:configEditor<?if(!$can_write):?>, readOnly:'nocursor'<?endif;?>}] starting at [?if(!$can_write):?>, readOnly:'nocursor'<?endif;?>}].

Any idea what the problem is?

5
  • 1
    will get more verbose stack trace output if you use development version of angular instead of min. Where's your code? Commented Jul 27, 2014 at 15:29
  • Thank you. I updated my post with more specific code and error message. Commented Jul 28, 2014 at 9:06
  • i guess reason is you are using html chars in your string Commented Jul 28, 2014 at 9:13
  • Thank you @HarishR. But what do you mean by "html chars"? How could I solve this issue? Commented Jul 28, 2014 at 9:14
  • <?if(!$can_write):?> this part... i dont know how would you solve, i have never used ui-codemirror Commented Jul 28, 2014 at 9:16

2 Answers 2

1

copy paste the first line of the error (which is http link) in browser, it will take you to errors.angularjs.org and there you can see the exact error

http://errors.angularjs.org/1.2.16/$parse/syntax?p0=%3F&p1=not%20a%20primary%20expression&p2=60&p3=%7BlineNumbers%3AshowLn%2C%20mode%3A'plaintext'%2C""nLoad%3AconfigEditor%3C%3Fif(!%can_write)%3A%3F%3E%2C%20readOnly%3A'nocursor'%3C%3Fendif%3B%3F%3E%7D&p4=%3Fif(!%can_write)%3A%3F%3E%2C%20readOnly%3A'nocursor'%3C%3Fendif%3B%3F%3E%7D

the error in this case is

Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].

i dont know what above error exactly is, but this is how i start debugging the errors...

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

1 Comment

Thank you. I managed to get a more specific message of the error and I updated my post.
0

Finally I managed to solve this issue by adding php. Like this:

<textarea ui-codemirror="{lineNumbers:showLn, mode:'plaintext', onLoad:configEditor<?php if(!$can_write):?>, readOnly:'nocursor'<?php endif;?>}"
    >
</textarea>

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.