fix(animations): treat numeric state name values as strings (#22923)

This patch ensures that if a numeric state name value in an animation
is detected then it will not throw an error. Normally this wouldn't
occur, but some JS optimizers may convert a quoted numeric value
(like "1" to 1) in some cases to save space. This patch makes sure
that Angular doesn't throw an error when this occurs.

PR Close #22923
This commit is contained in:
Matias Niemelä
2018-03-21 19:58:37 -07:00
parent d77bb460b0
commit e5e1b0da33
2 changed files with 12 additions and 1 deletions

View File

@ -96,7 +96,7 @@ export class AnimationAstBuilderVisitor implements AnimationDslVisitor {
if (def.type == AnimationMetadataType.State) {
const stateDef = def as AnimationStateMetadata;
const name = stateDef.name;
name.split(/\s*,\s*/).forEach(n => {
name.toString().split(/\s*,\s*/).forEach(n => {
stateDef.name = n;
states.push(this.visitState(stateDef, context));
});