Generating files

You can add more TypeScript files and templates manually, but it is more effective to do so with the CLI tool. This is because the CLI tool not only creates files but also generates starter snippets to represent the kind of file you are trying to create. For example, let's create a quote component:

ng generate component quote# ORng g component quote

This is what the component command looks like with some of the generated codes and files:

The image comprises of the following:

  1. The CLI output of the generation process.
  2. The generated component, template, CSS, and test files.
  3. The TypeScript component.

The CLI can be used to ...

Get TypeScript 2.x for Angular Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.