Skip to content

Commit

Permalink
fix($parse): allow for new lines in expr when promise unwrapping is on
Browse files Browse the repository at this point in the history
Previously, when unwrapping promises was set to `true`,
an error would occur if a parsed expression had a
new line in it.
This was because when generating the `evaledFnGetter` code,
a new line in an parsed expression would create a new line
in a JS string in that code, which is illegal. That is:
```js
pw("A+
B")
```

Closes angular#4718
  • Loading branch information
rodyhaddad authored and jamesdaily committed Jan 27, 2014
1 parent 9046263 commit e6d23d4
Show file tree
Hide file tree
Showing 2 changed files with 671 additions and 660 deletions.
2 changes: 1 addition & 1 deletion src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ function getterFn(path, options, fullExp) {
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
(options.unwrapPromises
? 'if (s && s.then) {\n' +
' pw("' + fullExp.replace(/\"/g, '\\"') + '");\n' +
' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +
' if (!("$$v" in s)) {\n' +
' p=s;\n' +
' p.$$v = undefined;\n' +
Expand Down
Loading

0 comments on commit e6d23d4

Please sign in to comment.