From 43e9fc0303b9dcc6b786aaad3b3e9a9a31dc4ee3 Mon Sep 17 00:00:00 2001 From: ghetolay Date: Sat, 5 Nov 2016 21:26:11 +0100 Subject: [PATCH] Resolve bug with opened state not being part of changeDetection --- src/components/ionic/datepickerionic.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/ionic/datepickerionic.ts b/src/components/ionic/datepickerionic.ts index ff9dafb0a..86075606d 100644 --- a/src/components/ionic/datepickerionic.ts +++ b/src/components/ionic/datepickerionic.ts @@ -1,4 +1,4 @@ -import { Component, Input, ElementRef, OnInit, Renderer, ChangeDetectorRef } from '@angular/core'; +import { Component, Input, ElementRef, OnInit, Renderer, ChangeDetectorRef, Optional } from '@angular/core'; import * as moment from 'moment'; @@ -18,7 +18,7 @@ export class DatePickerIonicComponent extends DatePickerTemplate return extendConfig( super.extendConfig({ templateUrl: './ionic.component.html', - styleUrls: ['ionic.scss'], + styleUrls: ['ionic.css'], inputs: ['class', 'expanded', 'opened', 'viewFormat'] }, componentClass), config @@ -37,14 +37,25 @@ export class DatePickerIonicComponent extends DatePickerTemplate this._class = DatePickerIonicComponent.CONTAINER_CLASS + ' ' + classStr; } - /*@Input()*/ expanded: boolean; - /*@Input()*/ opened = false; + private _opened = false; + get opened() { + return this._opened; + } - /*@Input()*/ viewFormat = 'LL'; + /*@Input()*/ + set opened(b: boolean){ + if( this._opened !== b ) { + this._opened = b; + this.cd.markForCheck(); + } + } + + /*@Input()*/ expanded: boolean; + /*@Input()*/ viewFormat = 'LL'; private el: Element; - constructor(renderer: Renderer, elRef: ElementRef, cd: ChangeDetectorRef, select: BaseSelect) { + constructor(renderer: Renderer, elRef: ElementRef, cd: ChangeDetectorRef, @Optional() select: BaseSelect) { super(cd, select); this.el = elRef.nativeElement;