Javascript 基本角度组件不显示在浏览器中
我刚刚运行了Javascript 基本角度组件不显示在浏览器中,javascript,angular,angular8,Javascript,Angular,Angular8,我刚刚运行了ngserve-o,只看到我刚刚开始修改的angular应用程序中显示的index.html文件。目前,该页面只是向您问好: // index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Appclient</title> <base href="/"> <meta nam
ngserve-o
,只看到我刚刚开始修改的angular应用程序中显示的index.html
文件。目前,该页面只是向您问好:
// index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Appclient</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>hello</app-root>
</body>
</html>
我不确定我错过了什么
控制台错误为:
ReferenceError: global is not defined
index.js:43
第18页
您需要在
app.module.ts
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
const routes: Routes = [
{ path: 'hello', component: HelloComponent }
];
@NgModule({
imports: [ BrowserModule, FormsModule, RouterModule.forRoot(routes) ],
exports: [ RouterModule ],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
和
用于设置项目我确实设置了它,但当我开始添加内容时,它出错了浏览器控制台中显示的错误是什么?请不要错过检查控制台!看看这个
ReferenceError: global is not defined
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
const routes: Routes = [
{ path: 'hello', component: HelloComponent }
];
@NgModule({
imports: [ BrowserModule, FormsModule, RouterModule.forRoot(routes) ],
exports: [ RouterModule ],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }