0

Angular 2 中是否有任何方法可以为路由器添加的每个孩子设置通用样式?

In my particular case I use flex boxes and so I need each parent to have display:flex style. But as you know, each Angular component wrap its content and produce its own container dynamically. I know I can use :host styles to cover this need. I know I can also use ng-deep on the router-outlet parent styles to push them down to the children. Is there any other way to address this?

4

1 回答 1

1

如果你愿意,你可以在 div 中换行

<div style='display: flex'>
 <router-outlet></router-outlet>
<div>

或者

::ng-deep flex {
  display: flex
}
于 2017-09-18T14:22:50.243 回答