#100DAYSOFCODE Day61

#100DAYSOFCODE Day61

Learn about Angular

  • used the CLI to create a second component.
  • displayed the second component by adding it to the AppComponent shell.
  • applied the UppercasePipe to format the name.
  • used two-way data binding with the ngModel directive.
  • learned about the AppModule.
  • imported the FormsModule in the AppModule so that Angular would recognize and apply the ngModel directive.
  • learned the importance of declaring components in the AppModule and appreciated that the CLI declared it for you

terminal

create new project:
$ ng new my-app
run app:
$ ng serve --open
create new component:
$ ng generate component home

HTML

uppercase:
<h2>{{hero.name | uppercase}} Details</h2>

update data:
<div>
  <label for="name">Hero name: </label>
  <input id="name" [(ngModel)]="hero.name" placeholder="name" />
</div>