【发布时间】:2014-09-19 10:40:10
【问题描述】:
我正在开发一个 Wordpress 和 Angularjs 项目。
当我加载其中一个页面时,我在 Chrome 开发工具中收到此错误:
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;?>}].
这是错误所在的代码:
<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>
谁能帮我找出问题所在?
【问题讨论】:
-
调试此问题的一个策略是转到第 60 列的
?(如错误所示)并弄清楚您打算在那里做什么。 -
我不明白为什么我对这个问题投了反对票。据我所知,
<?是一种有效的 PHP 语法。但是,它给了我一个语法错误,这就是我问的原因。
标签: javascript php wordpress angularjs