Skip to content

Commit

Permalink
fix(slide-toggle): remove view encapsulation (#1446)
Browse files Browse the repository at this point in the history
* fix(slide-toggle): remove view encapsulation

* Removes the ViewEncapsulation from the slide-toggle component to allow developer overwriting the styles easly.

Fixes #1343.

* Make _hasFocus variable public again for AOT compiler
  • Loading branch information
devversion authored and jelbourn committed Oct 18, 2016
1 parent bfee9c3 commit cbecbce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/slide-toggle/slide-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $md-slide-toggle-margin: 16px !default;
@include md-temporary-ink-ripple(slide-toggle, true);
}

:host {
md-slide-toggle {
display: flex;
height: $md-slide-toggle-height;

Expand Down
6 changes: 5 additions & 1 deletion src/lib/slide-toggle/slide-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
AfterContentInit,
NgModule,
ModuleWithProviders,
ViewEncapsulation,
} from '@angular/core';
import {HAMMER_GESTURE_CONFIG} from '@angular/platform-browser';
import {
Expand Down Expand Up @@ -50,6 +51,7 @@ let nextId = 0;
templateUrl: 'slide-toggle.html',
styleUrls: ['slide-toggle.css'],
providers: [MD_SLIDE_TOGGLE_VALUE_ACCESSOR],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MdSlideToggle implements AfterContentInit, ControlValueAccessor {
Expand All @@ -61,10 +63,12 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor {
private _uniqueId = `md-slide-toggle-${++nextId}`;
private _checked: boolean = false;
private _color: string;
_hasFocus: boolean = false;
private _isMousedown: boolean = false;
private _slideRenderer: SlideToggleRenderer = null;

// Needs to be public to support AOT compilation (as host binding).
_hasFocus: boolean = false;

@Input() @BooleanFieldValue() disabled: boolean = false;
@Input() @BooleanFieldValue() required: boolean = false;
@Input() name: string = null;
Expand Down

0 comments on commit cbecbce

Please sign in to comment.