Skip to content

Commit 2cc9ae5

Browse files
committed
chore(): change all components to onPush detection
1 parent 4cc5879 commit 2cc9ae5

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/components/button/button.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, View, ViewEncapsulation, Input, Attribute, HostBinding, HostListener} from 'angular2/core';
1+
import {Component, ViewEncapsulation, Input, HostBinding, HostListener, ChangeDetectionStrategy} from 'angular2/core';
22

33
// TODO(jelbourn): Ink ripples.
44
// TODO(jelbourn): Make the `isMouseDown` stuff done with one global listener.
@@ -17,7 +17,8 @@ import {Component, View, ViewEncapsulation, Input, Attribute, HostBinding, HostL
1717
},
1818
templateUrl: './components/button/button.html',
1919
styleUrls: ['./components/button/button.css'],
20-
encapsulation: ViewEncapsulation.None
20+
encapsulation: ViewEncapsulation.None,
21+
changeDetection: ChangeDetectionStrategy.OnPush,
2122
})
2223
export class MdButton {
2324
color: string;
@@ -93,4 +94,4 @@ export class MdAnchor extends MdButton {
9394
event.stopImmediatePropagation();
9495
}
9596
}
96-
}
97+
}

src/components/card/card.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, View, ViewEncapsulation} from 'angular2/core';
1+
import {Component, ViewEncapsulation, ChangeDetectionStrategy} from 'angular2/core';
22
import {CONST_EXPR} from 'angular2/src/facade/lang';
33

44
/*
@@ -23,7 +23,8 @@ While you can use this component alone, it also provides a number of preset styl
2323
selector: 'md-card',
2424
templateUrl: './components/card/card.html',
2525
styleUrls: ['./components/card/card.css'],
26-
encapsulation: ViewEncapsulation.None
26+
encapsulation: ViewEncapsulation.None,
27+
changeDetection: ChangeDetectionStrategy.OnPush,
2728
})
2829
export class MdCard {}
2930

@@ -44,7 +45,8 @@ TODO(kara): update link to demo site when it exists
4445
@Component({
4546
selector: 'md-card-header',
4647
templateUrl: '/components/card/card-header.html',
47-
encapsulation: ViewEncapsulation.None
48+
encapsulation: ViewEncapsulation.None,
49+
changeDetection: ChangeDetectionStrategy.OnPush,
4850
})
4951
export class MdCardHeader {}
5052

@@ -62,7 +64,8 @@ TODO(kara): update link to demo site when it exists
6264
@Component({
6365
selector: 'md-card-title-group',
6466
templateUrl: './components/card/card-title-group.html',
65-
encapsulation: ViewEncapsulation.None
67+
encapsulation: ViewEncapsulation.None,
68+
changeDetection: ChangeDetectionStrategy.OnPush,
6669
})
6770
export class MdCardTitleGroup {}
6871

src/components/sidenav/sidenav.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ import {
88
HostBinding,
99
HostListener,
1010
Input,
11-
View,
12-
ViewEncapsulation,
13-
OnChanges,
1411
Optional,
1512
Output,
16-
Query,
1713
QueryList,
18-
SimpleChange,
19-
Type
14+
Type,
15+
ChangeDetectionStrategy
2016
} from 'angular2/core';
2117
import {PromiseWrapper} from 'angular2/src/facade/promise';
2218
import {BaseException} from 'angular2/src/facade/exceptions';
@@ -50,6 +46,7 @@ export class MdDuplicatedSidenavException extends BaseException {
5046
@Component({
5147
selector: 'md-sidenav',
5248
template: '<ng-content></ng-content>',
49+
changeDetection: ChangeDetectionStrategy.OnPush,
5350
})
5451
export class MdSidenav {
5552
/** Alignment of the sidenav (direction neutral); whether 'start' or 'end'. */
@@ -250,6 +247,7 @@ export class MdSidenav {
250247
directives: [MdSidenav],
251248
templateUrl: './components/sidenav/sidenav.html',
252249
styleUrls: ['./components/sidenav/sidenav.css'],
250+
changeDetection: ChangeDetectionStrategy.OnPush,
253251
})
254252
export class MdSidenavLayout implements AfterContentInit {
255253
@ContentChildren(MdSidenav) private sidenavs_: QueryList<MdSidenav>;

0 commit comments

Comments
 (0)