hide_kichiの情報

気になる情報を適当にアップしていきます

【ANGULAR】コンポーネントの追加 NG GENERATE

f:id:hide_kichi:20190704174235j:plain 【ANGULAR】(スキルアップ

コンポーネントの追加

dosプロンプトで以下のコマンド実行します。

作業ディレクトリ( C:\basic_20190223\app\sample04\src\app)

ng generate component child01

ng generate component child02

の実行結果について

app.module.ts(実行前)

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.module.ts(実行後)

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { Child01Component } from './child01/child01.component';
import { Child02Component } from './child02/child02.component';

@NgModule({
  declarations: [
    AppComponent,
    Child01Component,
    Child02Component
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

実行ログ


 C:\basic_20190223\app\sample04\src\app のディレクトリ
2019/01/21  21:35                 0 app.component.css
2019/01/21  21:35             1,120 app.component.html
2019/01/21  21:35               984 app.component.spec.ts
2019/07/25  09:47               212 app.component.ts
2019/01/21  21:35               314 app.module.ts

C:\basic_20190223\app\sample04\src\app>ng generate component child01

CREATE src/app/child01/child01.component.html (26 bytes)
CREATE src/app/child01/child01.component.spec.ts (635 bytes)
CREATE src/app/child01/child01.component.ts (273 bytes)
CREATE src/app/child01/child01.component.css (0 bytes)
UPDATE src/app/app.module.ts (400 bytes)

C:\basic_20190223\app\sample04\src\app>ng generate component child02
CREATE src/app/child02/child02.component.html (26 bytes)
CREATE src/app/child02/child02.component.spec.ts (635 bytes)
CREATE src/app/child02/child02.component.ts (273 bytes)
CREATE src/app/child02/child02.component.css (0 bytes)
UPDATE src/app/app.module.ts (486 bytes)

C:\basic_20190223\app\sample04\src\app>

C:\basic_20190223\app\sample04\src\app>dir
 ドライブ C のボリューム ラベルがありません。
 ボリューム シリアル番号は 66DC-B395 です

2019/01/21  21:35                 0 app.component.css
2019/01/21  21:35             1,120 app.component.html
2019/01/21  21:35               984 app.component.spec.ts
2019/07/25  09:47               212 app.component.ts
2019/07/25  10:15               486 app.module.ts

2019/07/25  10:14    DIR          child01
2019/07/25  10:15    DIR          child02
 
--------------------------------------------------------------------------

ANGULAR 勉強するには

AngularによるモダンWeb開発 基礎編 第2版

AngularによるモダンWeb開発 基礎編 第2版

これがいいと思います。