It's time to create a new project with angular-cli
as described in Chapter 2, Setting Up an Angular 2 Development Environment with angular-cli. We will create a new directory called components
to contain all the components we will implement in this chapter.
We will later create two other subdirectories in this chapter, accordion
and user-info
, when implementing the corresponding components:
The last thing before starting to build our new components is to clean up our root component. Open index.ts
and clean it as follows:
[app.component.ts] import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: '<h1>Angular2 Components</h1>' }) export class AppComponent {}
Open your browser and make sure that the component has rendered without any errors:
Now we are ready to start developing our new components.