From 914ae1adb8df739c04754ccd5b79bff281c184fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Bregu=C5=82a?= Date: Mon, 25 Apr 2016 21:18:56 +0200 Subject: [PATCH] fix(accordion): Panel isn't resizing after content has changed fixes #454 Example: http://plnkr.co/edit/Y5CKUFEchwov0LdgT6rZ 1. Open accordian 2. Mulple click add button 3. Button was hidden --- components/collapse/collapse.component.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/collapse/collapse.component.ts b/components/collapse/collapse.component.ts index 72726c904d..0f4c9246b5 100644 --- a/components/collapse/collapse.component.ts +++ b/components/collapse/collapse.component.ts @@ -1,4 +1,4 @@ -import {Directive, OnInit, ElementRef, Input, HostBinding} from 'angular2/core'; +import {Directive, OnInit, ElementRef, Input, HostBinding, Renderer} from 'angular2/core'; import {AnimationBuilder} from 'angular2/src/animate/animation_builder'; // fix: replace with // 'angular2/animate'; // when https://github.com/angular/angular/issues/5984 will be fixed @@ -42,11 +42,12 @@ export class Collapse implements OnInit { private _ab:AnimationBuilder; private _el:ElementRef; + private _renderer:Renderer; - public constructor(_ab:AnimationBuilder, _el:ElementRef) { + public constructor(_ab:AnimationBuilder, _el:ElementRef, _renderer: Renderer) { this._ab = _ab; this._el = _el; - + this._renderer = _renderer; } public ngOnInit():void { @@ -120,7 +121,8 @@ export class Collapse implements OnInit { .onComplete(() => { this.isCollapse = true; this.isCollapsing = false; - this._el.nativeElement.style.overflow = 'visible'; + this._renderer.setElementStyle(this._el.nativeElement, 'overflow', 'visible'); + this._renderer.setElementStyle(this._el.nativeElement, 'height', 'auto'); }); }, 4); }