fix(compiler): use the other case by default in ICU messages

This commit is contained in:
Victor Berchet
2016-11-04 14:52:02 -07:00
committed by vikerman
parent 4708b248d5
commit 55dc0e4a5f
3 changed files with 18 additions and 8 deletions

View File

@ -106,6 +106,13 @@ function _expandDefaultForm(ast: html.Expansion, errors: ParseError[]): html.Ele
const expansionResult = expandNodes(c.expression);
errors.push(...expansionResult.errors);
if (c.value === 'other') {
// other is the default case when no values match
return new html.Element(
`template`, [new html.Attribute('ngSwitchDefault', '', c.valueSourceSpan)],
expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
}
return new html.Element(
`template`, [new html.Attribute('ngSwitchCase', `${c.value}`, c.valueSourceSpan)],
expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);