15. HOW TO SUPPORT NG-MODEL
<my-calendar [(ngModel)]="date">
@Component({
selector: 'my-calendar',
template: '…'
})
export class MyCalendar {
value: Date;
}
CAN'T BIND TO NGMODEL SINCE IT ISN'T A KNOWN PROPERTY
48. PROBLEM WITH NGONCHANGES
NOT INTUITIVE
ngOnChanges(changes: SimpleChanges) {
if(changes[‘totalRecords’]) //do this
else if(changes[‘rows’]) // do that
else if(changes[‘disabled’]) //come on!!!
}
62. MONKEY PATCHING
A monkey patch is a way for a program to extend or
modify supporting system software locally
(affecting only the running instance of the program).
ZONE API
63. GAME OF ZONES - PERFORMANCE
<div draggable (dragover)=“handleDrag($event)”>
64. GAME OF ZONES - PERFORMANCE
dragOverListener: Function;
bindEvents() {
this.zone.runOutsideAngular(() => {
this.dragOverListener = this.onDragOver.bind(this);
this.el.nativeElement.addEventListener('dragover', this.dragOverListener);
});
}
ngOnDestroy() {
if (this.dragOverListener) {
document.removeEventListener('dragover', this.dragOverListener);
this.dragOverListener = null;
}
}