From 40647b179c473f3f470bb1b3237d6f006269582f Mon Sep 17 00:00:00 2001 From: rodyhaddad Date: Wed, 30 Oct 2013 15:14:00 -0400 Subject: 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 --- src/ng/parse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ng/parse.js') diff --git a/src/ng/parse.js b/src/ng/parse.js index c93d07de..3be98573 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -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' + -- cgit v1.2.3