grunt build给出了Lexer Error,打破了app ng-include

时间:2014-03-04 06:17:34

标签: javascript angularjs gruntjs angularjs-ng-include

当我部署未经授权的代码时,一切都很有效。然后我运行grunt build并从dist文件夹部署,就像你一样。当我检查其中一个页面虽然它中断了但我在控制台中出错:

Error: [$parse:lexerr] Lexer Error: Unexpected next character  at columns 0-0 [\] in expression [\].
http://errors.angularjs.org/1.2.6/$parse/lexerr?p0=Unexpected%20nextharacter%20&p1=s%200-0%20%5B%5C%5D&p2=%5C
    at https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:3:30474
    at Zd.throwError (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:6:14396)
    at Zd.lex (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:6:13696)
    at $d.parse (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:6:16445)
    at https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:5:13197
    at e.parseAs (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:5:23401)
    at Object.e.(anonymous function) [as parseAsResourceUrl] (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:5:23604)
    at https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:6:28873
    at q (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:4:23046)
    at h (https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackc…051d66623ecd89e823feea72a720eec0f43eac2/scripts/244c37f5.vendor.js:4:19250) 

在页面上,我有一个表达,我怀疑是在破坏:

ng-include='"views/posts.html"'

在github上,dist文件夹中的标签如下所示:

ng-include="\"views/posts.html\""

grunt build这样做会破坏我的代码?它从app/部署时有效,但在我从dist/部署时无效。

有没有更好的方法来撰写我的ng-include

1 个答案:

答案 0 :(得分:1)

我有些错误 使用 ng-click

<a ng-click="#/search/San+Francisco">test</a>

而不是 ng-href

<a ng-href="#/search/San+Francisco">test</a>

我希望它可以提供帮助