简体   繁体   English

从一个组件到另一个组件的Angular 2路由然后不应用CSS

[英]Angular 2 routing from one component to another then CSS is not applied

When I route from one component to another then CSS is not applied for that new component. 当我从一个组件路由到另一个组件时,则CSS不适用于该新组件。 But when I inspect the element it shows css properties are applied to the element but not rendered. 但是,当我检查元素时,它显示css属性已应用于该元素但未呈现。 But when I refresh the page or even close the dev tools then that element is displayed on screen immediately without making any changes. 但是,当我刷新页面甚至关闭开发工具时,该元素将立即显示在屏幕上,而无需进行任何更改。

So not sure how to go about resolving this issue. 因此,不确定如何解决此问题。

This issue was related to fonts. 此问题与字体有关。 As we are using angular-cli which uses webpack to bundling. 当我们使用angular-cli时,它使用webpack进行捆绑。 Webpack was unable to bundle fonts properly which was causing it to not render the elements correctly. Webpack无法正确捆绑字体,这导致其无法正确呈现元素。 Its a known issue in angular-cli https://github.com/angular/angular-cli/issues/1463 它是angular-cli一个已知问题https://github.com/angular/angular-cli/issues/1463

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM