mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-27 11:40:27 +00:00
fix($parse): allow for new lines in expr when promise unwrapping is on
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 #4718
This commit is contained in:
parent
0421cb4200
commit
40647b179c
2 changed files with 737 additions and 726 deletions
|
|
@ -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' +
|
||||
|
|
|
|||
1461
test/ng/parseSpec.js
1461
test/ng/parseSpec.js
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue