LoginSignup
1
1

More than 5 years have passed since last update.

Angular5 基礎メモ

Posted at

初期設定

npm install -g @angular/cli
cd angular-tour-of-heroes
ng serve --open

ng serveコマンドはアプリケーションをビルド、開発用サーバーを起動し、ソースファイルを監視します。 あなたが監視されているファイルに変更を行ったときには、変更があったファイルに対し再ビルドを行います。

--openフラグを指定すると、http://localhost:4200がブラウザで開かれます。

コーディング規約

よく使うngコマンド

# Add Component
ng generate component hero-detail --module=app

# Add Service 
ng generate service message

# Add Module
ng generate module app-routing --flat --module=app
※--flatは、固有のフォルダの代わりに、src/appに生成したファイルを置きます。

テンプレート内の記号について

# - variable declaration

() - event binding

[] - property binding

[()] - two-way property binding

{{ }} - interpolation

* - structural directives

# は下記のように使うことができる

 <span [hidden]="harry.value">*</span>
 <input type="text" #harry>
 {{ harry.value }}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1