Angular My app.component.html未显示在我的应用程序中
我的app.component.html如下所示Angular My app.component.html未显示在我的应用程序中,angular,Angular,我的app.component.html如下所示 \<div>abcd</div> import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { tit
\<div>abcd</div>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'LoginApp';
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>LoginApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography">
<app-root></app-root>
</body>
</html>
我的index.html如下所示
\<div>abcd</div>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'LoginApp';
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>LoginApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography">
<app-root></app-root>
</body>
</html>
罗吉纳普
这是一个非常简单的代码。我不明白问题出在哪里…有人能帮忙吗?
如果我在index.html中添加任何文本,那么它将显示在浏览器中如果您有斜杠,这将导致错误: 在app.component.html文件中,尝试以下操作:
<div style="display: flex; height: 100vh; width: 100vw; justify-content: center; color: #333"><h1>hello</h1></div>
你好
您是使用
ng new
命令还是手动创建项目的?您是否在控制台上看到任何错误?控制台中没有错误