angular新版 父组件修改子组件某个div样式
生活随笔
收集整理的這篇文章主要介紹了
angular新版 父组件修改子组件某个div样式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<!-- 父組件 father.html -->
<div class="wrapper"><app-child></app-child>
</div>
<!-- 子組件 child.html -->
<div class="modal-header">123</div>
方法一,在父組件樣式文件中修改子組件樣式
.wrapper{::ng-deep {.modal-header{color: red}} }方法二,在子組件樣式文件中,根據父組件來改變自身樣式
:host-context(.wraper) .modal-header {color: red; }總結
以上是生活随笔為你收集整理的angular新版 父组件修改子组件某个div样式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python3 time
- 下一篇: python3 open()内置函数