Receive Template Parse Error whenever object key starts with a number

Greetings all!

I am currently encountering issues while attempting to parse object keys that start with numbers. I find whenever I load a document from Google Firebase Firestore with a key that starts with a number I encounter the following error:

Error: Template parse errors:
Parser Error: Unexpected token ‘0.3’ at column 3 in [
{{ v.3title }}
] in ng:///AppModule/HomePage.html@19:33 ("

-->
[ERROR ->] {{ v.3title }}

“): ng:///AppModule/HomePage.html@19:33
Parser Error: Unexpected token ‘0.3’ at column 3 in [
{{ v.3title }}
] in ng:///AppModule/HomePage.html@19:33 (”

<button ion-button ERROR ->=“addObject()”>Add Object

"): ng:///AppModule/HomePage.html@23:21
at syntaxError (http://localhost:8100/build/vendor.js:86871:34)
at TemplateParser.parse (http://localhost:8100/build/vendor.js:111059:19)
at JitCompiler._parseTemplate (http://localhost:8100/build/vendor.js:121014:37)
at JitCompiler._compileTemplate (http://localhost:8100/build/vendor.js:120989:23)
at http://localhost:8100/build/vendor.js:120890:62
at Set.forEach ()
at JitCompiler._compileComponents (http://localhost:8100/build/vendor.js:120890:19)
at http://localhost:8100/build/vendor.js:120760:19
at Object.then (http://localhost:8100/build/vendor.js:86860:77)
at JitCompiler._compileModuleAndComponents (http://localhost:8100/build/vendor.js:120759:26)

the vote object contains the following data:

{3title: "test", title: "test"}

If I replace v.3title with v.title, the error disappears.

I’ve searched google extensively for an answer to this questions, with no luck. Can someone please educate me on what is going on?

I eventually intend to reference other document keys which may include a number in a similar way. Example:

{
: <3votes>,
: <5votes>,
}

each boxerKey may start with a number.

What’s the code that creates the error?

I know absolutely nothing about Firebase, but if you’re using JSON as an interchange format, keys that start with numbers must be quoted - they are not valid JavaScript identifiers. If v.3title is intended to be a template expression, it’s illegal for the same reason. You would have to write it in an alternate way like v["3title"].

1 Like