1 min read

Create a Angular application Part 3 – Create a Angular component

Inside the project folder type the Angular CLI command to generate a new component.

ng generate component heroes

Now launch VS code in the project folder.

Next in the heroes component add a property named hero.

  hero = 'Windstorm';

And next create a databinding to the property in the html template file.

<h2>{{hero}}</h2>

Finally inside the AppComponent remove all code and add an element to the html template.

<h1>{{title}}</h1>
<app-heroes></app-heroes>

Now go to the browser and see your updated Angular app!

In the next post we’ll add an interface and create a Hero object instead!

Leave a Reply