diff --git a/nativescript-angular/renderer.ts b/nativescript-angular/renderer.ts index aadc69a1a..51d54edc1 100644 --- a/nativescript-angular/renderer.ts +++ b/nativescript-angular/renderer.ts @@ -356,7 +356,7 @@ class EmulatedRenderer extends NativeScriptRenderer { private addStyles(styles: (string | any[])[], componentId: string) { styles.map(s => s.toString()) .map(s => replaceNgAttribute(s, componentId)) - .forEach(addStyleToCss); + .forEach(addScopedStyleToCss); } } @@ -365,6 +365,11 @@ const addStyleToCss = profile('"renderer".addStyleToCss', function addStyleToCss addCss(style); }); +// tslint:disable-next-line +const addScopedStyleToCss = profile('"renderer".addScopedStyleToCss', function addScopedStyleToCss(style: string): void { + addCss(style, true); +}); + function replaceNgAttribute(input: string, componentId: string): string { return input.replace(COMPONENT_REGEX, componentId); }