0

When I deploy my unminified code everything works great. Then I run grunt build and deploy from the dist folder, as you do. When I check out one of the pages though it breaks and I get an error in the console:

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) 

On the page I have an expression that I'm suspicious is doing the breaking:

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

On github that tag in the dist folder looks like:

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

What's grunt build doing that's breaking my code? It works when deploying from app/ but not when I deploy from dist/.

Is there a better way to write my ng-include?

Connor Leech
  • 18,052
  • 30
  • 105
  • 150
  • Does `ng-include="'views/posts.html'"` (switch single and double quotes) help at all? That's the first thing I'd try and pretty much a wild guess. – ivarni Mar 04 '14 at 06:48

1 Answers1

1

I had some error while I used ng-click

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

instead of ng-href

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

I hope it might help

printminion
  • 2,988
  • 1
  • 26
  • 30
  • Do you know why this work? I have a project where ng-cllick works. Then I copied that project to be a boilerplate to another project. My second project did not worked because of ng-click. When I changed ng-click to ng-href on my second project, then it started to work. I am curious about why. – milkersarac Jul 08 '16 at 10:56