a front-end framework from Google
markup and functionality
import { Component } from '@angular/core';
@Component({
selector: 'animal',
template: `<h1>{{name}}</h1>`
})
export class AnimalComponent { name = 'Zebra'; }
anatomy of a
export class AnimalComponent {
private name: string = 'Zebra';
private isMammal: boolean = true;
private speak(): void {
alert(this.name);
}
}
logic
<h1>{{name}}</h1>
<p *ngIf="isMammal">I'm a mammal!</p>
view
@Component({
selector: 'animal',
templateUrl: './animal.component.html',
styleUrls: ['./animal.component.css'],
providers: [AnimalService]
})
imports and dependencies
@Component({
selector: 'animal',
templateUrl: './animal.component.html',
styleUrls: ['./animal.component.css'],
providers: [AnimalService]
})
generic logic
hook in your data
<!-- interpolation -->
<p>Hi {{user.firstName}}!</p>
<!-- property binding -->
<user-profile [user]="userData"></user>
<!-- property binding -->
<button (click)="initBlinkingMarquee()">
Gimme some marquee
</button>
<!-- two-way binding -->
<input [(ngModel)]="hero.name" />
<li *ngFor="let hero of heroes"></li>
<hero-detail *ngIf="selectedHero"></hero-detail>
alter layout by adding, removing, and replacing elements in DOM
<input [(ngModel)]="hero.name">
<button myBlinkingBg bgColor="red"></button>
alter the appearance or behavior of an existing element
based on ember CLI
makes Javascript fun/tolerable???