2014-03-04 74 views
0

當我部署我的unminified代碼時,一切都很好。然後我運行grunt build並從dist文件夾進行部署,就像你一樣。當我檢查了,雖然它打破了網頁之一,我在控制檯中的錯誤:grunt build給Lexer錯誤,打破應用程序ng-include

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

+0

是否NG-'包括=「'views/posts.html'」'(切換單引號和雙引號)幫助呢?這是我嘗試的第一件事,幾乎是一個瘋狂的猜測。 – ivarni

回答

1

我有一些錯誤,而我 使用NG單擊

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

代替NG-HREF

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

我希望它可以幫助

+0

你知道這件作品爲什麼嗎?我有一個ng-cllick工程的項目。然後我將該項目複製到另一個項目的樣板。我的第二個項目因ng-click而無法使用。當我在第二個項目中將ng-click更改爲ng-href時,它開始工作。我很好奇爲什麼。 – milkersarac