Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 40647b1

Browse files
rodyhaddadIgorMinar
authored andcommitted
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
1 parent 0421cb4 commit 40647b1

File tree

2 files changed

+671
-660
lines changed

2 files changed

+671
-660
lines changed

src/ng/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ function getterFn(path, options, fullExp) {
10171017
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
10181018
(options.unwrapPromises
10191019
? 'if (s && s.then) {\n' +
1020-
' pw("' + fullExp.replace(/\"/g, '\\"') + '");\n' +
1020+
' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +
10211021
' if (!("$$v" in s)) {\n' +
10221022
' p=s;\n' +
10231023
' p.$$v = undefined;\n' +

0 commit comments

Comments
 (0)