【发布时间】:2022-10-14 14:22:15
【问题描述】:
我有一个简单的 hello world 组件,我想为其设置边框。似乎主机元素的宽度为 0 px,我无法更改。 (我可以在 h1 元素周围做一个边框,但不能在包含的角度组件周围。)
这是我的堆栈闪电战:https://stackblitz.com/edit/angular-ivy-jbjcdt?file=src/app/app.component.html
这是组件:
import { Component, Input } from '@angular/core';
@Component({
selector: 'hello',
template: `<h1>Hello World!</h1>`,
styles: [`h1 { font-family: Lato; }`],
})
export class HelloComponent {
@Input() name: string;
}
这是 app.component.html:
<hello style="width:500px; background-color:red; border:dashed blue"></hello>
【问题讨论】:
标签: angular