chore(): change all components to onPush detection

This commit is contained in:
Jeremy Elbourn
2016-02-10 16:22:09 -08:00
parent 4cc58798f8
commit 2cc9ae5aab
3 changed files with 15 additions and 13 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
import {Component, View, ViewEncapsulation, Input, Attribute, HostBinding, HostListener} from 'angular2/core';
import {Component, ViewEncapsulation, Input, HostBinding, HostListener, ChangeDetectionStrategy} from 'angular2/core';
// TODO(jelbourn): Ink ripples.
// TODO(jelbourn): Make the `isMouseDown` stuff done with one global listener.
@@ -17,7 +17,8 @@ import {Component, View, ViewEncapsulation, Input, Attribute, HostBinding, HostL
},
templateUrl: './components/button/button.html',
styleUrls: ['./components/button/button.css'],
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdButton {
color: string;
@@ -93,4 +94,4 @@ export class MdAnchor extends MdButton {
event.stopImmediatePropagation();
}
}
}
}
+7 -4
View File
@@ -1,4 +1,4 @@
import {Component, View, ViewEncapsulation} from 'angular2/core';
import {Component, ViewEncapsulation, ChangeDetectionStrategy} from 'angular2/core';
import {CONST_EXPR} from 'angular2/src/facade/lang';
/*
@@ -23,7 +23,8 @@ While you can use this component alone, it also provides a number of preset styl
selector: 'md-card',
templateUrl: './components/card/card.html',
styleUrls: ['./components/card/card.css'],
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdCard {}
@@ -44,7 +45,8 @@ TODO(kara): update link to demo site when it exists
@Component({
selector: 'md-card-header',
templateUrl: '/components/card/card-header.html',
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdCardHeader {}
@@ -62,7 +64,8 @@ TODO(kara): update link to demo site when it exists
@Component({
selector: 'md-card-title-group',
templateUrl: './components/card/card-title-group.html',
encapsulation: ViewEncapsulation.None
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdCardTitleGroup {}
+4 -6
View File
@@ -8,15 +8,11 @@ import {
HostBinding,
HostListener,
Input,
View,
ViewEncapsulation,
OnChanges,
Optional,
Output,
Query,
QueryList,
SimpleChange,
Type
Type,
ChangeDetectionStrategy
} from 'angular2/core';
import {PromiseWrapper} from 'angular2/src/facade/promise';
import {BaseException} from 'angular2/src/facade/exceptions';
@@ -50,6 +46,7 @@ export class MdDuplicatedSidenavException extends BaseException {
@Component({
selector: 'md-sidenav',
template: '<ng-content></ng-content>',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdSidenav {
/** Alignment of the sidenav (direction neutral); whether 'start' or 'end'. */
@@ -250,6 +247,7 @@ export class MdSidenav {
directives: [MdSidenav],
templateUrl: './components/sidenav/sidenav.html',
styleUrls: ['./components/sidenav/sidenav.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MdSidenavLayout implements AfterContentInit {
@ContentChildren(MdSidenav) private sidenavs_: QueryList<MdSidenav>;