Angular Data Binding and Lifecycle Hooks
Classified in Design and Engineering
Written on  in  English with a size of 6.1 KB
English with a size of 6.1 KB
Binding
| One Way Binding | {{pageTitle}} | 
| Two Way Binding | |
| Property Binding | |
| Attribute Binding | Ok | 
| Class Binding | Selected | 
| ngClass | {{customer.name}} | 
| Style Binding | |
| ngStyle | {{customer.name}} | 
| Component Binding | |
| Directive Binding | Customer | 
| Event Binding | Save | 
| $event | 
Lifecycle Hooks
| OnInit | export class Customer implements OnInit { ngOnInit() {} } | 
| OnChanges | export class Customer implements OnChanges { ngOnChanges() {} } | 
| AfterViewInit | export class Customer implements AfterViewInit { ngAfterViewInit() {} } | 
| OnDestroy | export class Customer implements OnDestroy { ngOnDestroy() {} } | 
Pipes
| Upper Case | {{customer.name | uppercase}} | 
| Lower Case | {{customer.name | lowercase}} | 
| Date | {{orderDate | date:'medium'}} | 
| Date Format | {{orderDate | date:'yMMMd'}} | 
| Currency | {{price | currency}} | 
| Percent | {{taxes | percent:'1.1-1'}} | 
| Number | {{value | number:'1.1-2'}} | 
| JSON Debugging | {{Customer | json}} | 
Component with Inline Template
| import { Component } from '@angular/core';
 | 
Structural Directives
| *ngIf | Selected {{currentCustomer.Name}} | 
| *ngFor | 
 | 
| *ngSwitch | 
Service
| //Example: customer.service.ts | 
Injecting a Service
| //Example:  customer-list.component.ts | 
Component Linked Template
| import { Component } from '@angular/core'; | 
