相关疑难解决方法(0)

Angular 2:如何设置组件的主机元素?

我在Angular 2中有一个名为my-comp的组件:

<my-comp></my-comp>
Run Code Online (Sandbox Code Playgroud)

如何在Angular 2中设置此组件的主机元素的样式?

在Polymer中,您将使用":host"选择器.我在Angular 2中尝试过它.但它不起作用.

:host {
  display: block;
  width: 100%;
  height: 100%;
}
Run Code Online (Sandbox Code Playgroud)

我也尝试使用组件作为选择器:

my-comp {
  display: block;
  width: 100%;
  height: 100%;
}
Run Code Online (Sandbox Code Playgroud)

这两种方法似乎都不起作用.

谢谢.

css css-selectors angular-components angular

169
推荐指数
5
解决办法
12万
查看次数

Angular2 组件标签破坏了 flexbox 布局

我正在为纯 HTML5 和 CSS3 中的客户端构建 Web 应用程序的前端,并使用 flexbox 进行布局。我完成了第一页并将其发送给客户。他在 Angular2 组件标签中包装了一些代码,布局就中断了。

下面是问题的一个例子:

原始布局:https : //jsfiddle.net/starbreaker/jrqbhsuq/

HTML:

<div class="wrapper">

  <div class="child first">
    <h1>Some content</h1>
  </div>

  <div class="child second">
    <h1>Some more content</h1>
    <p>Help me if you can, I'm feeling down
       And I do appreciate you being 'round
       Help me get my feet back on the ground
       Won't you please, please help me
    </p>
    <p>When I was younger so much younger than today
       I never needed anybody's help in any way
       (But) …
Run Code Online (Sandbox Code Playgroud)

html css flexbox angular

5
推荐指数
1
解决办法
2809
查看次数

标签 统计

angular ×2

css ×2

angular-components ×1

css-selectors ×1

flexbox ×1

html ×1