A better Hello World
With an understanding of Angular basics and the CLI, let us go through an app building experience. We will build a basic project and then see how it gets enhanced as we add more components and some routing to the application. The completed code for this project is available for download under Chapter 9, Angular in a Nutshell. Here's the set of commands that will set up a hello-ng-dashboard
project with our components:
ng new hello-ng-dashboard --routing cd hello-ng-dashboard ng generate component header ng generate component footer ng generate component nav ng g c dashboard
Here, the g c
argument used for dashboard component creation is the same as generate component
as used for others. For each component, the CLI will create a folder by the name of the component, containing the TypeScript file along with HTML and CSS files. These components will need to be declared as part of a module. This is done for us by the CLI, which updates the AppModule
(app.module.ts
) with declarations...