# Angularでwebアプリを作成する時「コンポーネントのベストプラクティス」

1 min read
Table of Contents

Layout

header や footer 等 全てのページで使われるパーツ

ng g component layouts/componentName

Pages

ページごとのコンテンツを表示するページ

ng g component pages/componentName

Parts

layout や page で使われるカードなどの UI パーツ

ng g component parts/componentName

テストをするためには必要だが、無駄なファイルを増やさないために

ng generate component componentName --skip-tests

でspecファイルを作らずに済む。

コンポーネントを呼び出したい

<app-componentName></app-componentName>

で、コンポーネントを呼び込む。

My avatar

Thanks for reading my blog post! Feel free to check out my other posts or contact me via the social links in the footer.


More Posts

Comments