Skip to content

Commit

Permalink
compat: selection list not working in compatibility mode (#6801)
Browse files Browse the repository at this point in the history
Fixes the selection list not working in M1 compatibility mode.

Fixes #6746.
  • Loading branch information
crisbeto authored and tinayuangao committed Sep 6, 2017
1 parent 87d607e commit f1b78d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/lib/list/list-option.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<div class="mat-list-item-content" [class.mat-list-item-content-reverse]="checkboxPosition == 'after'" [class.mat-list-item-disabled]="disabled">
<div class="mat-list-item-ripple" md-ripple
[mdRippleTrigger]="_getHostElement()"
[mdRippleDisabled]="_isRippleDisabled()">
</div>
<div class="mat-list-item-content"
[class.mat-list-item-content-reverse]="checkboxPosition == 'after'"
[class.mat-list-item-disabled]="disabled">

<div md-ripple
class="mat-list-item-ripple"
[mdRippleTrigger]="_getHostElement()"
[mdRippleDisabled]="_isRippleDisabled()"></div>

<md-pseudo-checkbox #autocheckbox
[state]="selected ? 'checked' : 'unchecked'"
[disabled]="disabled"></md-pseudo-checkbox>

<md-pseudo-checkbox [state]="selected ? 'checked' : 'unchecked'" #autocheckbox [disabled]="disabled"></md-pseudo-checkbox>
<div class="mat-list-text"><ng-content></ng-content></div>

</div>
6 changes: 4 additions & 2 deletions src/lib/list/selection-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled';
import {RxChain, switchMap, startWith} from '../core/rxjs/index';
import {merge} from 'rxjs/observable/merge';
import {CanDisableRipple, mixinDisableRipple} from '../core/common-behaviors/disable-ripple';
import {MATERIAL_COMPATIBILITY_MODE} from '../core/compatibility/compatibility';


export class MdSelectionListBase {}
export const _MdSelectionListMixinBase = mixinDisableRipple(mixinDisabled(MdSelectionListBase));
Expand Down Expand Up @@ -68,14 +70,14 @@ const FOCUSED_STYLE: string = 'mat-list-item-focus';
},
templateUrl: 'list-option.html',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [{provide: MATERIAL_COMPATIBILITY_MODE, useValue: false}],
})
export class MdListOption extends _MdListOptionMixinBase
implements AfterContentInit, OnDestroy, FocusableOption, CanDisableRipple {

private _lineSetter: MdLineSetter;
private _selected: boolean = false;
/** Whether the checkbox is disabled. */
private _disabled: boolean = false;
private _value: any;

Expand Down

0 comments on commit f1b78d4

Please sign in to comment.