# HTML

## Interpolation

```markup
<div> {{title}} </div>
<div> {{title | uppercase }} </div>
```

`| uppercase` = a pipe

## Two way binding

In app.module.ts and added to import list:

```typescript
import { FormsModule } from '@angular/forms';
```

In html:

```markup
<label>name:
  <input [(ngModel)]="hero.name" placeholder="name">
</label>
```

## Loops

```markup
<ul class="heroes">
  <li *ngFor="let hero of heroes">
          {{hero.id}}
  </li>
</ul>
```

## Event Binding

OnSelect defined in ts for this component

```markup
<div (click)="onSelect(hero)">  
<button (click)="add(heroName.value); heroName.value=''">
  add
</button>
```

## If

if selectedHero exists/defined

```markup
<div *ngIf="selectedHero">
```

## Conditional Classes

```markup
[class.some-css-class]="some-condition"
<li [class.selected]="hero === selectedHero"> hi </li>
```

## Property Binding(used with [@Input](#input) )

```markup
<component [hero]="selectedHero"> </component>
```
