fix(ivy): take styles extracted from template into account in JIT mode (#34017)

Prior to this commit, all styles extracted from Component's template (defined using <style> tags) were ignored by JIT compiler, so only `styles` array values defined in @Component decorator were used. This change updates JIT compiler to take styles extracted from the template into account. It also ensures correct order where `styles` array values are applied first and template styles are applied second.

PR Close #34017
This commit is contained in:
Andrew Kushnir
2019-11-23 15:36:00 -08:00
committed by Matias Niemelä
parent d655093123
commit 5de7960f01
3 changed files with 32 additions and 2 deletions

View File

@ -142,7 +142,7 @@ export class CompilerFacadeImpl implements CompilerFacade {
selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
template,
wrapDirectivesAndPipesInClosure: false,
styles: facade.styles || [],
styles: [...facade.styles, ...template.styles],
encapsulation: facade.encapsulation as any,
interpolation: interpolationConfig,
changeDetection: facade.changeDetection,