【发布时间】:2018-10-23 14:46:58
【问题描述】:
我找到了codepen,它是一个登录页面。我想把它放在我的角度应用程序中,但我无法设置背景样式。我的背景是空的。
这是我在 Angular 应用程序中添加的内容: 1.html文件
<div class="login">
<h1>Login</h1>
<form method="post">
<input type="text" name="u" placeholder="Username" required="required"/>
<input type="password" name="p" placeholder="Password" required="required"/>
<button type="submit" class="btn btn-primary btn-block btn-large">Let me in.</button>
</form>
</div>
然后我将codepen中对应的css文件放到我的angular应用中的.scss文件中。
您可以在 codepen 中查看更多代码,我只是将复制粘贴到我的 Angular 应用程序中,以下是我的 .ts 文件(用于组件):
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
所以,我的问题是:如何设置角度组件的“主体”样式? (我想把这个组件作为一个整体使用)
【问题讨论】: