Angular 4和Bootstrap-将容器类添加到组件选择器 [英] Angular 4 and bootstrap - Adding container class to component selector

查看:44
本文介绍了Angular 4和Bootstrap-将容器类添加到组件选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将bootstrap的容器类添加到组件选择器,以便所有子元素都对bootsrap类做出反应

I am currently adding bootstrap's container class to the component selector so all child elements react to bootsrap classes

例如,在我已应用的index.html文件中

for example in the index.html file i've applied

<app-root class="container"></app-root>

并在自举应用程序app.component.html中应用

and in the bootstrapped app.component.html I've applied

<app-header class="row"></app-header>

不确定是否建议这样做?

Not sure if this is the recommended approach?

推荐答案

我在app.component中建议将容器类

I recomend in app.component put the container class

<div class="container">

       <app-header></app-header>

</div>

并在组件app-header.component中

and in the component app-header.component

<div class="row">
    ...
</div>

这篇关于Angular 4和Bootstrap-将容器类添加到组件选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆