这是我项目中模板的一个片段。
<footer>
© {{ (new Date()).getUTCFullYear() }} Company
</footer>
Funfact是(new Date()).getUTCFullYear()
是有效的JS语法。角度投掷错误的原因是什么?
这是堆栈跟踪/错误:
Error: Template parse errors:
Parser Error: Missing expected ) at column 7 in [
© {{ (new Date()).getUTCFullYear() }} Company
] in ng:///AppModule/AppComponent.html@20:8 ("
</main>
<footer>[ERROR ->]
© {{ (new Date()).getUTCFullYear() }} Company
</footer>
"): ng:///AppModule/AppComponent.html@20:8
at syntaxError (http://localhost:3000/main.bundle.js:42542:34)
at TemplateParser.parse (http://localhost:3000/main.bundle.js:53033:19)
at JitCompiler._compileTemplate (http://localhost:3000/main.bundle.js:66784:39)
at http://localhost:3000/main.bundle.js:66708:62
at Set.forEach (native)
at JitCompiler._compileComponents (http://localhost:3000/main.bundle.js:66708:19)
at createResult (http://localhost:3000/main.bundle.js:66593:19)
at ZoneDelegate.invoke (http://localhost:3000/main.bundle.js:85093:26)
at Zone.run (http://localhost:3000/main.bundle.js:84975:43)
at http://localhost:3000/main.bundle.js:85363:57