From 36458ab5a6345bcea94f29387c0cd708051533e7 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Sun, 18 Dec 2016 12:35:34 +0000 Subject: [PATCH] feat: remove change detection strategy from all components (#101) BREAKING CHANGE: For enhanced performance it is recommended that you add `changeDetection: ChangeDetectionStrategy.OnPush` on all components that use this library. This will restrict change detection to only run when the components inputs change Closes #94 --- demo/demo.component.ts | 3 ++- src/components/day/calendarDayView.component.ts | 2 -- src/components/month/calendarMonthView.component.ts | 2 -- src/components/week/calendarWeekView.component.ts | 2 -- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/demo/demo.component.ts b/demo/demo.component.ts index 935f57095..f90d11b9b 100644 --- a/demo/demo.component.ts +++ b/demo/demo.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, ChangeDetectionStrategy } from '@angular/core'; import { startOfDay, subDays, @@ -36,6 +36,7 @@ const colors: any = { @Component({ selector: 'mwl-demo-app', + changeDetection: ChangeDetectionStrategy.OnPush, styles: [` h3 { margin: 0; diff --git a/src/components/day/calendarDayView.component.ts b/src/components/day/calendarDayView.component.ts index 3440daef2..78ec5c4fa 100644 --- a/src/components/day/calendarDayView.component.ts +++ b/src/components/day/calendarDayView.component.ts @@ -1,6 +1,5 @@ import { Component, - ChangeDetectionStrategy, Input, OnChanges, Output, @@ -20,7 +19,6 @@ const SEGMENT_HEIGHT: number = 30; @Component({ selector: 'mwl-calendar-day-view', - changeDetection: ChangeDetectionStrategy.OnPush, template: `
diff --git a/src/components/week/calendarWeekView.component.ts b/src/components/week/calendarWeekView.component.ts index 8f604f5e1..468fc0ea4 100644 --- a/src/components/week/calendarWeekView.component.ts +++ b/src/components/week/calendarWeekView.component.ts @@ -3,7 +3,6 @@ import { Input, Output, EventEmitter, - ChangeDetectionStrategy, ChangeDetectorRef, OnChanges, OnInit, @@ -27,7 +26,6 @@ import { CalendarEventTimesChangedEvent } from './../../interfaces/calendarEvent @Component({ selector: 'mwl-calendar-week-view', - changeDetection: ChangeDetectionStrategy.OnPush, template: `