0
動作しない私は、角2との新たなんだ、私は、このコマンド表示内容は
ng generate component hello
を持つコンポーネントを生成していると、すべてのファイルが生成され、app.module.tsが更新されます。 index.htmlをで
私はこの
<app-hello></app-hello>
が、空白になるWebページを追加した、何も表示されません。
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HelloComponent } from './hello/hello.component';
@NgModule({
declarations: [
AppComponent,
HelloComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
'bootstrap:[AppComponent]'を 'bootstrap:[HelloComponent]'に置き換えてみてください – yurzui
ブートストラップにコンポーネントをリストして、これらのコンポーネントが開始点であることを角度で伝えます。これは、angularがこれらのコンポーネントを特別な方法でコンパイルし(ホストファクトリを生成する)、コンポーネントセレクタを満たす要素を探し出すことを意味します。これらの要素の内部にコンポーネントtemplate.https://stackoverflow.com/questions/44077178/what-does-it-mean-to-bootstrap-an-angular-application/44077696#44077696 – yurzui
が置かれます。ブートストラップのメインコンポーネントへのインデックス –