double quotes just outside a mustache confuses the angular parser #937
Description
to reproduce:
git clone https://github.com/angular/angular.dart.tutorial
cd angular.dart.tutorial/Chapter_03
pub install
python -m SimpleHTTPServer
replace web/index.html with this
<!DOCTYPE html>
<html ng-app>
<body>
"{{true}}"
<script src="packages/shadow_dom/shadow_dom.min.js"></script>
<script type="application/dart" src="main.dart"></script>
<script type="text/javascript" src="packages/browser/dart.js"></script>
</body>
</html>
navigate to localhost:8000/web/index.html with chromium
you will see a stack trace coming from angular:
Bad state: Can not watch expression containing ';'.
STACKTRACE:
#0 ExpressionVisitor._notSupported (package:angular/core/scope.dart:1094:5)
#1 ExpressionVisitor.visitChain (package:angular/core/scope.dart:1090:18)
#2 Chain.accept (package:angular/core/parser/syntax.dart:73:48)
#3 DynamicExpression.accept (package:angular/core/parser/dynamic_parser.dart:46:48)
#4 ExpressionVisitor.visit (package:angular/core/scope.dart:984:15)
#5 _AstParser.call (package:angular/core/scope.dart:968:73)
...
set a breakpoint in scope.dart:1094, then ascend the call stack
to see what's happening at Scope.watch inside scope.dart:228.
inspect the 'expression' variable and you will see
"
""+(true|stringify)+""
"
yes, the double quotes here are literal. so i'm saying that
expression[0] == '"'
and
expression[1] == '\n'
, etc.
the page will also display "{{true}}"
, which is wrong.
you shouldn't see the {{}}
.
now change index.html: replace "{{true}}"
by a{{true}}b
.
so all i've done here is replace the double quotes with the "simpler" delimiters a and b.
reload the page and you will see no error and it will correctly display atrueb
.