Skip to content

Commit

Permalink
fix(slides): set class using renderer instead of host
Browse files Browse the repository at this point in the history
fixes #6275
  • Loading branch information
brandyscarney committed May 5, 2016
1 parent f355087 commit 132d8e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions ionic/components/slides/slides.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Directive, Component, ElementRef, Host, EventEmitter, Input, Output, ChangeDetectionStrategy, ViewEncapsulation} from 'angular2/core';
import {Directive, Component, ElementRef, Renderer, Host, EventEmitter, Input, Output, ChangeDetectionStrategy, ViewEncapsulation} from 'angular2/core';
import {NgClass} from 'angular2/common';

import {Ion} from '../ion';
Expand Down Expand Up @@ -193,9 +193,6 @@ import {Scroll} from '../scroll/scroll';
'<div [class.hide]="!showPager" class="swiper-pagination"></div>' +
'</div>',
directives: [NgClass],
host: {
'[class]': 'slideId'
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
Expand Down Expand Up @@ -340,14 +337,16 @@ export class Slides extends Ion {
@Output() move: EventEmitter<any> = new EventEmitter();


constructor(elementRef: ElementRef) {
constructor(elementRef: ElementRef, renderer: Renderer) {
super(elementRef);
this.rapidUpdate = debounce(() => {
this.update();
}, 10);

this.id = ++slidesId;
this.slideId = 'slides-' + this.id;

renderer.setElementClass(elementRef.nativeElement, this.slideId, true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ionic/components/slides/test/controller/main.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ion-slides #mySlider [options]="mySlideOptions" (didChange)="onSlideChanged()">
<ion-slides #mySlider [options]="mySlideOptions" (didChange)="onSlideChanged()" class="my-slides">
<ion-slide padding>
<h1>Slide 1</h1>
<button block (click)="goToPrevSlide()">Navigate Back</button>
Expand Down

0 comments on commit 132d8e9

Please sign in to comment.